If I have the folowing file:
XX:YY:ZZ foobar: some text
XX:YY:ZZ foobar: some other text
a text breaking the pattern
XX:YY:ZZ foobar: some more text
And I want to operate on the differents parts XX:YY:ZZ foobar:
of the lines. When I am on the first line I can select the text that I want with, for example, v3f:
. Now when I am on the second or on the last line how can I select this same text without type once again v3f:
?
I insist on the fact that I need to select the texts sequentially and not all the occurences at the same time.
I know the command gv
which allows to re-select the last selected area but in my case it will select the 16 first characters of the first line which is not what I want.
To sum it up How can I execute again the last selection command?
(Also I wasn't sure about the tags I should use for this question don't hesitate to edit/suggest the right ones to use)
:help visual-search
simple example for search selected text::vmap X y/<C-R>"<CR>" and
gn` - Search forward for the last used search pattern, like withn
, and start Visual mode to select the match.gn
part which I didn't know.:help viusual-search
. it's just simple example. Second part: navigate forwad to the next matched pattern. Liken
in normal mode but visual mode have own mappinggn
for more explanation:help gn
.<C-R>"
part, this way the search will be done on the last search pattern and the user can yank another piece of text without breaking the mapping. Also if I may suggest you to edit your comment for the comfort of future users that would be nice ;)