Sourcing (just-some-lines) from .vim file
The title is pretty much self-explanatory; is there a way to just source a couple of selected lines from a .vim file, instead of copying it to a new buffer, saving it, ... etc.
I don't want to (after writing it in a file) rewriting it in a command line, 开发者_运维技巧but just select it and source it. Unfortunatelly, "source" doesn't work on a range.
Bright ideas welcomed :)
You could use a custom command combined with g//
command! -range=% RSource <line1>,<line2>g/./exe getline('.')
Then select you're code, hit :
and type RSource
(so the command line should look like :'<,'>RSource
).
精彩评论