Technology
 

Use Taglist with LaTeX files

From Vim Tips Wiki

Tip 453 Previous Next created April 14, 2003 · complexity intermediate · author Florent Manens · version 6.0


First, you have to add a new language to ctags.

in ~/.ctags add :

--langdef=tex
--langmap=tex:.tex
--regex-tex=/\\subsubsection[ \t]*\*?\{[ \t]*([^}]*)\}/- \1/s,subsubsection/
--regex-tex=/\\subsection[ \t]*\*?\{[ \t]*([^}]*)\}/+\1/s,subsection/
--regex-tex=/\\section[ \t]*\*?\{[ \t]*([^}]*)\}/\1/s,section/
--regex-tex=/\\chapter[ \t]*\*?\{[ \t]*([^}]*)\}/\1/c,chapter/
--regex-tex=/\\label[ \t]*\*?\{[ \t]*([^}]*)\}/\1/l,label/
--regex-tex=/\\ref[ \t]*\*?\{[ \t]*([^}]*)\}/\1/r,ref/

Edit taglist.vim (my patch for version 2.4) :

--- taglist.vim 2003-04-14 16:47:25.000000000 +0200
+++ .vim/plugin/taglist.vim 2003-04-14 15:00:04.000000000 +0200
@@ -509,6 +509,9 @@
 " vim language
 let s:tlist_def_vim_settings = 'vim;a:autocmds;v:variable;f:function'

+" tex language
+let s:tlist_def_tex_settings = 'tex;s:section;c:chapter;l:label;r:ref'
+
 " yacc language
 let s:tlist_def_yacc_settings = 'yacc;l:label'

In Vim, type:

:Tlist

or see taglist doc

[edit] References

[edit] Comments

You can add "ctags.cnf" in your $HOME path (e.g. C:\Documents and Settings\User\ctags.cnf) on Windows. It works in my test under Windows XP Proffessional.


If you use vim-latex suite with taglist there is a problem with F9 completion where it doesn't return to the currect window and so tries to write the completion in the unmodifiable taglist window. I am using latexSuite20060325 and to fix it I added the line the line:

      exe s:winnum.' wincmd w'

as the first line of the function Tex_CompleteWord in texviewer.vim (which was for me line 216).