> I want to execute the format command, gq, on multiple blocks of text
> that I select. The best way would be if I could execute gq in ex mode,
> that is:
>
> :g/pattern1/,/pattern2/gq<ENTER>
>
> But gq doesnt work in ex mode.
This could be written something like
:g/pattern1/norm gq/pattern2^M
where ^M is entered as control+V followed by control+M.
Alternatively, you could create a macro for it:
qa/pattern1^Mv/pattern2^mgqq
(in this case the "^M" is literally hitting enter at that point
to perform the search) and then @a as many times as you need. Or
you could do it as a macro returned by the expression register:
999@='/pattern1^Mv/pattern2^Mgq'
(where "^M" is the control+V version here)
It might help to turn off 'wrapscan':
:set nowrapscan
999@a
for the macro versions.
-tim
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
No comments:
Post a Comment