3

I have a Python project where there are lots of functions with the same name in different files. Some symbols are reasonably unique and C-] will jump to the right definition. However, others are very common. Right now I look at the word and if it's something generic like upload I hit g] to be prompted for a list of possible definition sites. Is there a way to get the number of possible ctag matches for the word currently under the cursor so I can make C-] do g] when the symbol is ambiguous?

5

g<C-]> will display a list of tags only when there is more than one, so you could just train yourself to type g<C-]> instead of <C-]>. But having to type two characters instead of one, especially when one takes a modifier, is a pain, so what I would do is put this mapping in your ~/.vimrc:

:nnoremap <C-]> g<C-]>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.