Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Highlight search pattern without moving cursor

Tags:

vim

In vim, is it possible to highlight a search pattern without moving the cursor?

For example, if I want to find m_depthTable I could do:

/m_depthTable

and that will highlight all instances of m_depthTable, but it will also move to the next occurance.

I want to highlight without moving. Possible?

like image 312
John Dibling Avatar asked Aug 29 '13 19:08

John Dibling


2 Answers

You could do a substitute command with the n flag. This won't move the cursor or do the substitute.

:s/pattern//n
like image 140
FDinoff Avatar answered Nov 01 '22 01:11

FDinoff


just

/pattern<enter>

then press ``

like image 30
Kent Avatar answered Nov 01 '22 01:11

Kent