On Nov 9, 12:25 pm, [email protected] wrote:
> I simply git tired to do this in a loop:
> :
> <enter partly wrong regexp based command here>
> <cr>
> (selection gets deselected here)
> :gv<cr>
> :
> .
> .
> .
> .
> and so on.

You said you knew that :'<,'> operates on the last visual area without
needing to reselect, but your example suggests otherwise.

You could just do this:

<visually select area of interest>
:
<enter partially wrong regex>
<CR>
:
<enter partially wrong regex>
<CR>
:
<enter partially wrong regex>
...etc.

There is NO NEED to reselect the visual selection if you're operating
on the same area that you previously selected. The following commands
will ALL operate on the SAME area, until you manually select a new
visual selection:

:'<,'>s/abc/def/g
:'<,'>s/1bc/def/g
:'<,'>s/1abc/def/g
:'<,'>s/1a2bc/def/g
:'<,'>s/12abc/def/g

The '<,'> is inserted automatically when you press : in visual mode,
and I assume you don't retype the entire regular expression every
iteration, but rather use command history to retrieve it and edit it.
If so, the '<,'> will already be there.

Additionally, you example uses the :gv ex command, a.k.a. :gvim, which
starts the gui when Vim is started in a terminal. We have been
referring to the gv normal-mode command, which reselects the lats
visual area (and is, as I show above, not necessary for your given
example). I rarely get complex regular expressions correct on my first
try, and use the same overall method that you do to correct them, but
without reselecting the visual area already contained in the '< and '>
marks.
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to