tags:

views:

577

answers:

4

vim + ctags works well for C projects, since C does not allow function overloading and, in general encourages manual prefixing of symbols due to rudimentary scoping facilities.

In C++, functions are frequently overloaded, and overridden in subclasses. This makes vim always jump to the tag in the wrong class on "Ctrl + ]". Is there a way to make it behave a little more intelligently? I know I can bring a list with tag alternatives, but that's insanely annoying to always have to bring up this list, and find a needed tag by number whenever I want to jump to definition.

+5  A: 

There is also "tagNext" to move to the next tag (or :tn<enter>)

Martin York
+4  A: 

I know two workarounds for your porblem ( it seems you knew it too ):

  • Use :tselect and tag name or g] with cursor on tag for get list of matched tags and goto on tag by number from list;
  • map :tnext or :tprev on hotkeys ( I've mapped on F6 and F7 ) and find needed function manualy;
bb
+5  A: 

You can use my script which will help you to select tag you need by typing some letters of the class name or special tags like 'field', 'function', 'constructor', etc.

http://www.vim.org/scripts/script.php?script_id=2507

Mykola Golubyev
+4  A: 

I use tjump a lot. It supports tab completion which is helpful. If multiple tags are found, it will give a list for you to select from, if only one is found, it will jump right to the tag (unlike tselect).

Usage:

:tj foo
gpojd