xref: /vim-8.2.3635/runtime/ftplugin/tex.vim (revision c01140a1)
1" LaTeX filetype plugin
2" Language:     LaTeX (ft=tex)
3" Maintainer:   Benji Fisher, Ph.D. <[email protected]>
4" Version:	1.3
5" Last Change:	Wed 22 Mar 2006 09:36:32 AM EST
6"  URL:		http://www.vim.org/script.php?script_id=411
7
8" Only do this when not done yet for this buffer.
9if exists("b:did_ftplugin")
10  finish
11endif
12
13" Start with plain TeX.  This will also define b:did_ftplugin .
14source $VIMRUNTIME/ftplugin/plaintex.vim
15
16" Avoid problems if running in 'compatible' mode.
17let s:save_cpo = &cpo
18set cpo&vim
19
20" Allow "[d" to be used to find a macro definition:
21" Recognize plain TeX \def as well as LaTeX \newcommand and \renewcommand .
22" I may as well add the AMS-LaTeX DeclareMathOperator as well.
23let &l:define .= '\|\\\(re\)\=new\(boolean\|command\|counter\|environment\|font'
24	\ . '\|if\|length\|savebox\|theorem\(style\)\=\)\s*\*\=\s*{\='
25	\ . '\|DeclareMathOperator\s*{\=\s*'
26
27" Tell Vim how to recognize LaTeX \include{foo} and plain \input bar :
28let &l:include .= '\|\\include{'
29" On some file systems, "{" and "}" are inluded in 'isfname'.  In case the
30" TeX file has \include{fname} (LaTeX only), strip everything except "fname".
31let &l:includeexpr = "substitute(v:fname, '^.\\{-}{\\|}.*', '', 'g')"
32
33" The following lines enable the macros/matchit.vim plugin for
34" extended matching with the % key.
35" ftplugin/plaintex.vim already defines b:match_skip and b:match_ignorecase
36" and matches \(, \), \[, and \].
37if exists("loaded_matchit")
38  let b:match_words .= '\\begin\s*\({\a\+\*\=}\):\\end\s*\1'
39endif " exists("loaded_matchit")
40
41let &cpo = s:save_cpo
42
43" vim:sts=2:sw=2:
44