Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to navigate multiple ctags matches in Vim?

I'm using Ctrl-] in Vim to navigate using Ctags. How do I navigate to alternate file if there are multiple matches?

Ex. something.publish in a codebase containing multiple occurrences of publish:

class Foo   def publish   end end  class Bar   def publish   end end 
like image 591
Sathish Avatar asked Jan 22 '13 18:01

Sathish


People also ask

How do you navigate with ctags?

Vim's built-in code navigation functionality using ctags is fantastically useful. Properly configured, it can allow you to jump from file to file in a project with one or two keypresses. Position the cursor over an object or function name, press C-] and Vim takes you directly to its definition; C-o takes you back.

How do I list tags in Vim?

You can position the cursor over the tag and press g Ctrl-]. You can visually select a text and press g Ctrl-] to jump or list the matching tags. You can use the 'stjump' ex command. This will open the matching or selected tag from the tag list in a new window.

How do I set tags in Vim?

Select tag from tag list. You can select a particular tag from the tag list after opening the file in the vim editor by using ctags command. Open any source code in vim editor and type ':tselect' to find out the list of tag list of current source code. Here, the same file, abs_num.py is used to check this command.


1 Answers

Use g] instead of C-] to get the list of all matches.

You might want to read :help g]

like image 174
Dmitry Frank Avatar answered Sep 20 '22 17:09

Dmitry Frank