diff options
Diffstat (limited to 'plugin/command.vim')
-rw-r--r-- | plugin/command.vim | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/plugin/command.vim b/plugin/command.vim new file mode 100644 index 0000000..51633b5 --- /dev/null +++ b/plugin/command.vim @@ -0,0 +1,14 @@ +" g: is a command to run a vim command around a text object. +" +" For example, to do a substitution inside the current block, one can do: +" +" g:iBs/foo/bar/g<cr> + +noremap <silent> g: :set operatorfunc=<SID>do_command_around<cr>g@ + +function! s:do_command_around(str) abort + let [_, lnum0, _, _] = getpos("'[") + let [_, lnum1, _, _] = getpos("']") + + call feedkeys(printf(":%d,%d ", lnum0, lnum1)) +endfunction |