From 17703b92b44e5afd12e4bca418f61cadb50ac91d Mon Sep 17 00:00:00 2001 From: Josh Rahm Date: Mon, 22 Aug 2022 13:44:02 -0600 Subject: Add command motion and make some changes to substitute. --- plugin/command.vim | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 plugin/command.vim (limited to 'plugin/command.vim') 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 + +noremap g: :set operatorfunc=do_command_aroundg@ + +function! s:do_command_around(str) abort + let [_, lnum0, _, _] = getpos("'[") + let [_, lnum1, _, _] = getpos("']") + + call feedkeys(printf(":%d,%d ", lnum0, lnum1)) +endfunction -- cgit