Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vim incremental search

I'm using putty on a Linux machine. My usual method for searching in vi is entering the slash /, then my search string, enter, then go through all the matches by n or shift + n.

I was wondering if vi had a feature like Eclipse's Incremental Search (ctrl + j), wherein as I type, it jumps to the next logical match. I think one of my office mates used to do it but I'm not sure.

like image 464
Michael Sanchez Avatar asked Sep 03 '14 02:09

Michael Sanchez


People also ask

How do I cycle through a search in Vim?

Press Esc to cancel or press Enter to perform the search. Then press n to search forwards for the next occurrence, or N to search backwards. Type ggn to jump to the first match, or GN to jump to the last.

What is Incsearch Vim?

incsearch. vim is a Vim plugin which improve incremental searching. It provides functionality to highlight all matches while searching, to move cursor to next/previous match while searching and so on.


1 Answers

If you're using vim (and who isn't nowadays), you can enable incremental search with:

:set incsearch 

Then just use the regular search command / and it will move the highlight as you add characters to the search string.

I also like hlsearch as well since it highlights all found items (once the search command is done) for easy viewing.

like image 53
paxdiablo Avatar answered Sep 25 '22 19:09

paxdiablo