说我正在编辑我的vimrc文件,我输入了一行:
let xxx = 1
然后我想测试这一行,我必须进入正常模式,按':'并将此行复制到命令迷你缓冲区......
我可以通过1-2次击键来配置vim来运行该线路吗? 或者更进一步,我可以通过1-2次击键运行突出显示(可视模式)代码区域吗? 我认为有些人应该已经做过这样的事情,但是谷歌或这里找不到它。
谢谢!
答案 0 :(得分:0)
":[range]Execute Execute text lines as ex commands.
" Handles |line-continuation|.
" The same can be achieved via "zyy@z (or yy@" through the unnamed register);
" but there, the ex command must be preceded by a colon (i.e. :ex)
command! -bar -range Execute silent <line1>,<line2>yank z | let @z = substitute(@z, '\n\s*\\', '', 'g') | @z
" [count]<Leader>e Execute current [count] line(s) as ex commands, then
" {Visual}<Leader>e jump to the following line (to allow speedy sequential
" execution of multiple lines).
nnoremap <silent> <Leader>e :Execute<Bar>execute 'normal! ' . v:count1 . 'j'<CR>
xnoremap <silent> <Leader>e :Execute<Bar>execute 'normal! ' . v:count1 . 'j'<CR>