Highlight a search pattern without moving the cursor

In vim, is it possible to select a search template without moving the cursor?

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

 /m_depthTable 

which selects all instances of m_depthTable , but also moves to the next event.

I want to highlight without moving. Is it possible?

+6
source share
3 answers

You can run the substitute command with the n flag. This will not cause the cursor to move or replace.

 :s/pattern//n 
+7
source

only

 /pattern<enter> 

then click

+6
source

You can write directly to the register containing the last search pattern:

 :let @/="m_depthTable" 
+3
source

Source: https://habr.com/ru/post/952779/


All Articles