Say I\'m editing my _vimrc
file and I\'ve just added a couple of lines, for instance a new key mapping. I don\'t want to reload the whole file (:so %
For that purpose, I have defined the following commands and mappings:
":[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 ,yank z | let @z = substitute(@z, '\n\s*\\', '', 'g') | @z
" [count]e Execute current [count] line(s) as ex commands, then
" {Visual}e jump to the following line (to allow speedy sequential
" execution of multiple lines).
nnoremap e :Executeexecute 'normal! ' . v:count1 . 'j'
xnoremap e :Executeexecute 'normal! ' . v:count1 . 'j'