答案1
尝试将其添加到您的vimrc:
nmap <buffer> <silent> <expr> <F12> InsertCol()
imap <buffer> <silent> <expr> <F12> InsertCol()
function! InsertCol()
let w:first_call = exists('w:first_call') ? 0 : 1
"if w:first_call
" startinsert
"endif
try
let char = getchar()
catch /^Vim:Interrupt$/
let char = "\<Esc>"
endtry
if char == '^\d\+$' || type(char) == 0
let char = nr2char(char)
endif " It is the ascii code.
if char == "\<Esc>"
unlet w:first_call
return char
endif
redraw
if w:first_call
return char."\<Esc>gvA\<C-R>=Redraw()\<CR>\<F12>"
else
return char."\<Esc>gvlA\<C-R>=Redraw()\<CR>\<F12>"
endif
endfunction
function! Redraw()
redraw
return ''
endfunction
然后Ctrl-vI照常按,然后按F12。它将插入并显示每次击键更改的所有行。
F12注意:如果按会进入插入模式,脚本会更好,而不是要求您I每次都按。也许startinsert
命令结合起来vnoremap
可以做到这一点。