small background:

  • I have a code base with multiple languages: C, C++, Python, Sh, Makefile, Perl.
  • I configure my ctags generation right now to just do: C,C++,Python,Sh.
  • I point vim at the ctags tag file located at ~/tags (right now i only have one ctags tag file)

When I am editing a C++ file with extension *.cc, I hit ctrl+] to jump into the tag dummy_function_name and I get 10 matches and 9 out of 10 matches are for python files.

Can you ignore matching tags for a specific file extension (in this case python files)? if yes, how?

  • This might be possible using the tagfunc feature. Nov 6, 2020 at 7:34

1 Answer 1


(Disclaimer: I'm not the best at ctags but here is one solution I came up with on my own.)


  • for each language generate one ctags tag file
  • for each language tag file create a new vim autocommand that sets the tag file to the associated language tag file based on the file extension


This solution would required making your ctags generation more complex (instead of one tag file there are N tag files for N languages). In this example, you would one 3 tag files (one for C/C++, one for Python, one for Sh). Then your vim config would need to be more complex with N autocommands for the N tag files.

  • Added to .vimrc autocmd BufEnter,BufNew *.cc,*.hh set tags=/data/donn/ctags_cpp
    – Donn Lee
    Oct 6, 2022 at 23:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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