Trying to get to class / function definition in vim

I installed vim 7.2 and ctags 5.8 and created a tag file using "ctags -R / foopath".

I have many methods that are called with the same name in several classes, so if I put the cursor in the function that calls and I run ": tag", it shows the first of the listed tags. If I execute ": tn" several times, I will finally find a method.

So my question is: is there a way to show directly the path where the class is located that contains the correct method that I am calling?

+5
source share
2 answers

:tselect tagname , , .

:stselect tagname .

g], , .

<CTRL-W>] , .

<CTRL-W>g] .

+3

taglist(). , , .

, "mytag" :

:new | put =taglist(\"^mytag$\")

, Exuberant Ctags.

, 'filename': 'cmd':.

, :

" List information about matching tags in a buffer
function! BrowseTags(tagStr)
  new [Tag Brower]
  setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile nowrap

  put =taglist(a:tagStr)

  " Beautify it a little
  normal 1G
  while search('^{', 'W')
    call setline(".", split(getline("."), "\\(\\(}$\\)\\|\\('\\w\\+':\\)\\)\\@="))
  endw
  normal 1G
endfunc

BrowseTags ( "^ myTag $" ) myTag .

, , , .

0

All Articles