I’m using ctags to create a tags file for use in Vim, so that I can jump to definitions of labels and citations. However, I have two problems:
- ctags includes
\refin the tags file, so when I hit jump on a\reflabel, I don’t necessarily jump to the definition of the label, but might end up on another reference to that label. - I’d like to be able to jump to the corresponding entry in a .bib file from a
\citecommand, butctagsdoesn’t generate entries for that (I’m usingctags *.tex *.bib).
I wanted to redefine ctags‘s definition for tex files, so that I could remove \ref entries, but that didn’t work.
My ~/.ctags file:
--langdef=tex2
--langmap=tex2:.tex
--regex-tex2=/\\label[ \t]*\*?\{[ \t]*([^}]*)\}/\1/l,label/
I realized that I didn’t use exuberant ctags, but another ctags program, so the content in
~/.ctagswas never used.I also managed to add another entry in
~/.ctagsfor bib entries:ctags *.tex *.bibworks now as I want it.You can put a regex into an online regex explainer to understand what it is doing, like https://regexr.com/.