Vim go to tag: filter results by type (say go to function definition, ignore prototypes)

When I type C-]

, vim looks for the tag under the cursor and jumps to it. But often it goes to the function prototype, and I want to get down to the exact function definition. Then I have to enter g]

, look into the list for an element with the form "f", enter its number. It is much more painful if ctags

some macro is confused and pollutes the list with tons of false prototypes.

It would be nice if I had the ability to automatically ignore elements with a view p

(prototype). I know what I can do to ctags

not include prototypes in the tags file at all, but I don't want that, because sometimes I want to go to the prototype. I want Vim to filter it for me. How can i do this?

+3


source to share


1 answer


I wrote a small vim plugin for this kind of filtering (except that I wanted filtering by class name, not type): https://github.com/mgedmin/dotvim/blob/master/plugin/smart- tag.vim . It shouldn't be difficult to adapt if you know Python.



0


source







All Articles