Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Go to the next same word in Vim without using search

Is there a shortcut in Vim for going to the next word which is the same as the word cursor is on? It should work without typing the word with search command /.

like image 548
xralf Avatar asked Apr 04 '12 11:04

xralf


3 Answers

* goes to the next matching word and # goes to the previous matching word. * is so useful it's sometimes called the super star.

like image 76
JJJ Avatar answered Oct 20 '22 02:10

JJJ


* and # are your friends ( forward and backward directions respectively )

like image 21
Pavan Manjunath Avatar answered Oct 20 '22 00:10

Pavan Manjunath


To search the current word under the cursor use '*'.

to search backwards for current cursor word use '#'

like image 5
Rajesh Pantula Avatar answered Oct 20 '22 02:10

Rajesh Pantula