When using incremental search in vim, the cursor immediately goes to the next occurrence of the search term as far as you have typed it. Emacs has a similar incremental search function. However, there is a feature of emacs isearch that I have found very useful that I really would like in vim. In emacs, if you type:
<ctrl-s>word
it immediately goes to "word", just like vim incremental search. In emacs, you can now type additional <ctrl-s>
to move to the next result occurrence of "word" and in emacs this does not end your incremental search session. To do the same in vim, you must hit <cr>
, to end the search term, then hit n
to go to the next search result. Because emacs does not end the search session, you can do things like:
<ctrl-s>word<ctrl-s><ctrl-s>more
This lets you "home in" on your search once you get closer to where you want to go and turns out to be incredibly useful!
Is there a way to get vim to do the same?
/word
, 2)<CR>
, 3)n
, ...,n
, 4)/
, 5,<UP>
? You'll return to your search command, i.e./word
. Then you can continue enteringmore
.<UP>
, you could instead use<C-r>/
to insert search register that is contains your previous searched item.