Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Friday, October 16, 2026

Diff for vimconfig/vim/ftplugin/tex.vim between version 1.11 and 1.12

version 1.11, 2002/02/18 20:19:46 version 1.12, 2002/03/21 19:18:53
Line 1 
Line 1 
 " Vim filetype plugin file  " LaTeX filetype plugin
 " Language:             TeX, LaTeX  "         Language: LaTeX (ft=tex)
 " Maintainer:   Lubomir Host <host8@kepler.fmph.uniba.sk>  "       Maintainer: Srinath Avadhanula
 " License:              GNU GPL  "                Email: srinath@eecs.berkeley.edu
 " Version:              $Id$  "                  URL: http://vim.sourceforge.net/scripts/script.php?script_id=93
   "  Last Change: Thu Mar 21 06:00 AM 2002 PST
   "
   " Help:
   " NOTE: the macros which were previously placed in this file have been moved
   " to the plugin imaps.vim (get it from http://vim.sf.net).
   "
   " Changes: {{{
   " Mar 17 2002: 1. added errorformat and makeprg options for latex.
   " 2001 Dec 9: 1. took some stuff from auctex.vim
   "                               such as smart quotes and dollar, etc.
   " 2001 Dec 7: 1. changed things so that most mappings emulate the operator
   "                               pending mode. this greatly facilitates typing by not
   "                               requiring the LHS to be typed quickly. one can infact type
   "                               the LHS (without the <tab>), roam around in the file, come
   "                               back to the end of the file, press <tab> and still have the
   "                               LHS expand properly!
   "                         2. planning a second release for this.
   " }}}
   
   if exists("b:didLocalTex")
           finish
   end
   let b:didLocalTex = 1
   
 " Only do this when not done yet for this buffer  let s:save_cpo = &cpo
 if exists("b:did_ftplugin")  set cpo&vim
         finish  
 endif  
 let b:did_ftplugin = 1  
   
   setlocal isk+=:
   setlocal sw=2
   setlocal ts=2
 setlocal textwidth=72  setlocal textwidth=72
 setlocal formatoptions=croqt  setlocal formatoptions=croqt
 " iskeyword probably dosn't work correctly, dissabling  
 "setlocal iskeyword=a-z,A-Z,_,-,>,^\\,{,}  
   
 " These lines come from $VIMRUNTIME/ftplugin/tex.vim (modified) {{{  " These lines come from $VIMRUNTIME/ftplugin/tex.vim (modified by Lubomir Host) {{{
 " Thanks to Benji Fisher, Ph.D. <benji@member.AMS.org>  " Thanks to Benji Fisher, Ph.D. <benji@member.AMS.org>
 let s:save_cpo = &cpo  let s:save_cpo = &cpo
 set cpo&vim  set cpo&vim
Line 57  endif " exists("loaded_matchit")
Line 77  endif " exists("loaded_matchit")
 let &cpo = s:save_cpo  let &cpo = s:save_cpo
 " }}} end cut&paste form $VIMRUNTIME/ftplugin/tex.vim  " }}} end cut&paste form $VIMRUNTIME/ftplugin/tex.vim
   
 " These lines comes from file $VIMRUNTIME/compiler/tex.vim  {{{  " mappings {{{
 " Thanks to Artem Chuprina <ran@ran.pp.ru>  let s:ml = exists('g:mapleader') ? g:mapleader : '\'
 let s:cpo_save = &cpo  
 set cpo-=C  if !exists('s:doneMappings')
 setlocal errorformat=%E!\ LaTeX\ %trror:\ %m,          let s:doneMappings = 1
         \%E!\ %m,          " short forms for latex formatting and math elements. {{{
         \%+WLaTeX\ %.%#Warning:\ %.%#line\ %l%.%#,          " only a few of these are mine originally. otherwise taken from auctex.vim or
         \%+W%.%#\ at\ lines\ %l--%*\\d,          " miktexmacros.vim
         \%WLaTeX\ %.%#Warning:\ %m,          call IMAP ('__', '_{ä}«»', "tex")
         \%Cl.%l\ %m,          call IMAP ('()', '(ä)«»', "tex")
         \%+C\ \ %m.,          call IMAP ('[]', '[ä]«»', "tex")
         \%+C%.%#-%.%#,          call IMAP ('{}', '{ä}«»', "tex")
         \%+C%.%#[]%.%#,          call IMAP ('^^', '^{ä}«»', "tex")
         \%+C[]%.%#,          call IMAP ('$$', '$ä$«»', "tex")
         \%+C%.%#%[{}\\]%.%#,          call IMAP ('==', '&=& ', "tex")
         \%+C<%.%#>%.%#,          call IMAP ('...', '\cdots', "tex")
         \%C\ \ %m,          call IMAP ('::', '\dots', "tex")
         \%-GSee\ the\ LaTeX%m,          call IMAP ('((', '\left( ä \right)«»', "tex")
         \%-GType\ \ H\ <return>%m,          call IMAP ('[[', '\left[ ä \right]«»', "tex")
         \%-G\ ...%.%#,          call IMAP ('{{', '\left\{ ä \right\}«»', "tex")
         \%-G%.%#\ (C)\ %.%#,          call IMAP ('`^', '\hat{ä}«»', "tex")
         \%-G(see\ the\ transcript%.%#),          call IMAP ('`_', '\bar{ä}«»', "tex")
         \%-G\\s%#,          call IMAP ('`6', '\partial', "tex")
         \%+O(%f)%r,          call IMAP ('`8', '\infty', "tex")
         \%+P(%f%r,          call IMAP ('`/', '\frac{ä}{«»}«»', "tex")
         \%+P\ %\\=(%f%r,          call IMAP ('`%', '\frac{ä}{«»}«»', "tex")
         \%+P%*[^()](%f%r,          call IMAP ('`@', '\circ', "tex")
         \%+P[%\\d%[^()]%#(%f%r,          call IMAP ('`0', '^\circ', "tex")
         \%+Q)%r,          call IMAP ('`=', '\equiv', "tex")
         \%+Q%*[^()])%r,          call IMAP ('`\', '\setminus', "tex")
         \%+Q[%\\d%*[^()])%r          call IMAP ('`.', '\cdot', "tex")
 let &cpo = s:cpo_save          call IMAP ('`*', '\times', "tex")
 unlet s:cpo_save          call IMAP ('`&', '\wedge', "tex")
 " }}} end cut&paste from $VIMRUNTIME/compiler/tex/vim          call IMAP ('`-', '\bigcap', "tex")
           call IMAP ('`+', '\bigcup', "tex")
 " Mappings {{{          call IMAP ('`(', '\subset', "tex")
 " Add mappings, unless the user didn't want this.          call IMAP ('`)', '\supset', "tex")
 if !exists("no_plugin_maps") && !exists("no_tex_maps")          call IMAP ('`<', '\le', "tex")
         " Ctrl-F reformat paragraph          call IMAP ('`>', '\ge', "tex")
         if !hasmapto('<Plug>TexFormat')          call IMAP ('`,', '\nonumber', "tex")
                 imap <buffer> <C-F> <Plug>TexFormat          call IMAP ('`~', '\tilde{ä}«»', "tex")
                 map  <buffer> <C-F> <Plug>TexFormat          call IMAP ('`;', '\dot{ä}«»', "tex")
           call IMAP ('`:', '\ddot{ä}«»', "tex")
           call IMAP ('`2', '\sqrt{ä}«»', "tex")
       call IMAP ('`|', '\Big|', "tex")
           call IMAP ('`I', "\\int_{ä}^{«»}«»", 'tex')
           " }}}
           " latex environments (my style) originally in imaps.vim {{{
           call IMAP ("bar".s:ml, "\\leftä\<cr>\\begin{array}{«dimension»}\<cr>«elements»\<cr>\\end{array}\<cr>\\right«»", "tex")
           call IMAP ("ben".s:ml, "\\begin{enumerate}\<cr>\\item ä\<cr>\\end{enumerate}«»", "tex")
           call IMAP ("bit".s:ml, "\\begin{itemize}\<cr>\\item ä\<cr>\\end{itemize}«»", "tex")
           call IMAP ("beq".s:ml, "\\begin{equation}\<cr>\<cr>ä\\end{equation}«»", "tex")
           call IMAP ("bqn".s:ml, "\\begin{eqnarray}\<cr>ä\<cr>\\end{eqnarray}«»", "tex")
           call IMAP ("bfg".s:ml, "\\begin{figure}[h]\<cr>\\centerline{\\psfig{figure=«eps file»}}\<cr>\\caption{«caption text»}\<cr>\\label{fig:«label»}\<cr>\\end{figure}«»", "tex")
           call IMAP ("bfe".s:ml, "\\begin{figure}\<cr>\\vspace{ä}\<cr>\\caption{«caption text»}\<cr>\\end{figure}«»", "tex")
           call IMAP ("btb".s:ml, "\\begin{tabular}{ä}\<cr>\<cr>\\end{tabular}«»", "tex")
           call IMAP ("bta".s:ml, "\\begin{table}\<cr>\\centering\<cr>\\caption{tab:ä}\<cr>\\begin{tabular}{«dimensions»}\<cr>\<cr>\\end{tabular}\<cr>\\label{tab:«label»}\<cr>\\end{table}«»", "tex")
           call IMAP ("pic".s:ml, "\\begin{picture}(4,4)\<cr>\\put(0.5,0){\\framebox(4,4){ä}}\<cr>\\end{picture}«»", "tex")
           call IMAP ("mat".s:ml, "\\left[\<cr>\\begin{array}{ä}\<cr>«»\<cr>\\end{array}\<cr>\\right]«»", "tex")
           call IMAP ("verb".s:ml, "\\begin{verbatim}\<cr>\<cr>ä\\end{verbatim}«»", "tex")
           call IMAP ("minip".s:ml, "\\begin{minipage}[t]{äcm}\<cr>\\end{minipage}«»", "tex")
           " end my style latex environments }}}
           " latex environments from Mikolaj Machowski {{{
           function! <SID>TeX_imap_env(shortcut,env)
                   exe 'call IMAP ("'.a:shortcut.'",  "\\begin{'.a:env.'}\<cr>ä\<cr>\\end{'.a:env.'}«»", "tex")'
           endfunction
           call <SID>TeX_imap_env("EAB","abstract")
           call <SID>TeX_imap_env("EAP","appendix")
           call <SID>TeX_imap_env("EAR","array")
           call <SID>TeX_imap_env("ECE","center")
           call <SID>TeX_imap_env("EDE","description")
           call <SID>TeX_imap_env("EDI","displaymath")
           call <SID>TeX_imap_env("EDO","document")
           call <SID>TeX_imap_env("EEN","enumerate")
           call <SID>TeX_imap_env("EEA","eqnarray")
           call <SID>TeX_imap_env("EEQ","equation")
           call <SID>TeX_imap_env("EFI","figure")
           call <SID>TeX_imap_env("EFC","filecontents")
           call <SID>TeX_imap_env("EFL","flushleft")
           call <SID>TeX_imap_env("EFR","flushright")
           call <SID>TeX_imap_env("EIT","itemize")
           call <SID>TeX_imap_env("ELE","letter")
           call <SID>TeX_imap_env("ELI","list")
           call <SID>TeX_imap_env("ELR","lrbox")
           call <SID>TeX_imap_env("EMA","math")
           call <SID>TeX_imap_env("EMI","minipage")
           call <SID>TeX_imap_env("ENO","note")
           call <SID>TeX_imap_env("EOV","overlay")
           call <SID>TeX_imap_env("EPI","picture")
           call <SID>TeX_imap_env("EQN","quotation")
           call <SID>TeX_imap_env("EQE","quote")
           call <SID>TeX_imap_env("ESL","slide")
           call <SID>TeX_imap_env("ESB","sloppybar")
           call <SID>TeX_imap_env("ETA","tabbing")
           call <SID>TeX_imap_env("ETE","table")
           call <SID>TeX_imap_env("ETR","tabular")
           call <SID>TeX_imap_env("ETB","thebibliography")
           call <SID>TeX_imap_env("ETI","theindex")
           call <SID>TeX_imap_env("ETH","theorem")
           call <SID>TeX_imap_env("ETP","titlepage")
           call <SID>TeX_imap_env("ETL","trivlist")
           call <SID>TeX_imap_env("EVB","verbatim")
           call <SID>TeX_imap_env("EVS","verse")
           " }}}
           " other miscellaneous stuff taken from imaps.vim. {{{
           call IMAP ("vb".s:ml, "\\verb|ä|«»", "tex")
           call IMAP ("bf".s:ml, "{\\bf ä}«»", "tex")
           call IMAP ("em".s:ml, "{\\em ä}«»", "tex")
           call IMAP ("it".s:ml, "{\\it ä}«»", "tex")
           call IMAP ("mb".s:ml, "\\mbox{ä}«»", "tex")
           call IMAP ("frac".s:ml, "\\frac{ä}{«»}«»", "tex")
           call IMAP ("sq".s:ml, "\\sqrt{ä}«»", "tex")
           call IMAP ("eps".s:ml, "\\psfig{figure=ä.eps}«»", "tex")
           call IMAP ("sec".s:ml, "\\section{ä}«»", "tex")
           call IMAP ("ssec".s:ml, "\\subsection{ä}«»", "tex")
           call IMAP ("sssec".s:ml, "\\subsubsection{ä}«»", "tex")
           call IMAP ("sec2".s:ml, "\\subsection{ä}«»", "tex")
           call IMAP ("sec3".s:ml, "\\subsubsection{ä}«»", "tex")
           call IMAP ("sum".s:ml, "\\sum{ä}{«»}«»", "tex")
           call IMAP ("suml".s:ml, "\\sum\\limits_{ä}^{«»}«»", "tex")
           call IMAP ("int".s:ml, "\\int_{ä}^{«»}«»", "tex")
           call IMAP ("intl".s:ml, "\\int\\limits_{ä}^{«»}«»", "tex")
           call IMAP ("bbr".s:ml, "\\left( ä \\right)«»", "tex")
           call IMAP ("bbc".s:ml, "\\left\\{ ä \\right\\}«»", "tex")
           call IMAP ("bbs".s:ml, "\\left[ ä \\right]«»", "tex")
           call IMAP ("rr".s:ml, "\\right", "tex")
           call IMAP ("ll".s:ml, "\\left", "tex")
           call IMAP ("part".s:ml, "\\partial", "tex")
           call IMAP ("dot".s:ml, "\\dot{ä}«»", "tex")
           call IMAP ("ddot".s:ml, "\\ddot{ä}«»", "tex")
           " }}}
           " Greek letters imaps.vim style {{{
           call IMAP('`a', "\\alpha", "tex")
           call IMAP('`b', "\\beta", "tex")
           call IMAP('`c', "\\chi", "tex")
           call IMAP('`d', "\\delta", "tex")
           call IMAP('`e', "\\varepsilon", 'tex')
           call IMAP('`f', "\\varphi", 'tex')
           call IMAP('`g', "\\gamma", "tex")
           call IMAP('`h', "\\eta", "tex")
           call IMAP('`k', "\\kappa", "tex")
           call IMAP('`l', "\\lambda", "tex")
           call IMAP('`m', "\\mu", "tex")
           call IMAP('`n', "\\nu", "tex")
           call IMAP('`p', "\\pi", "tex")
           call IMAP('`q', "\\theta", "tex")
           call IMAP('`r', "\\rho", "tex")
           call IMAP('`s', "\\sigma", "tex")
           call IMAP('`t', "\\tau", "tex")
           call IMAP('`u', "\\upsilon", "tex")
           call IMAP('`v', "\\varsigma", "tex")
           call IMAP('`w', "\\omega", "tex")
           " call IMAP('`w', "\\wedge", 'tex')  " AUCTEX style
           call IMAP('`x', "\\xi", "tex")
           call IMAP('`y', "\\psi", "tex")
           call IMAP('`z', "\\zeta", "tex")
           call IMAP('`A', "\\Alpha", "tex")
           call IMAP('`B', "\\Beta", "tex")
           call IMAP('`C', "\\Chi", "tex")
           call IMAP('`D', "\\Delta", "tex")
           call IMAP('`E', "\\Epsilon", "tex")
           call IMAP('`F', "\\Phi", "tex")
           call IMAP('`G', "\\Gamma", "tex")
           call IMAP('`H', "\\Eta", "tex")
           call IMAP('`K', "\\Kappa", "tex")
           call IMAP('`L', "\\Lambda", "tex")
           call IMAP('`M', "\\Mu", "tex")
           call IMAP('`N', "\\Nu", "tex")
           call IMAP('`P', "\\Pi", "tex")
           call IMAP('`Q', "\\Theta", "tex")
           call IMAP('`R', "\\Rho", "tex")
           call IMAP('`S', "\\Sigma", "tex")
           call IMAP('`T', "\\Tau", "tex")
           call IMAP('`U', "\\Upsilon", "tex")
           call IMAP('`V', "\\Varsigma", "tex")
           call IMAP('`W', "\\Omega", "tex")
           call IMAP('`X', "\\Xi", "tex")
           call IMAP('`Y', "\\Psi", "tex")
           call IMAP('`Z', "\\Zeta", "tex")
           " }}}
           " Diacritics from Lubomir Host {{{
           call IMAP ('=a', "\\\'{a}", 'tex')
           call IMAP ('+a', "\\v{a}", 'tex')
           call IMAP ('+}', "\\\"{a}", 'tex')
           call IMAP ('=b', "\\'{b}", 'tex')
           call IMAP ('+b', "\\v{b}", 'tex')
           call IMAP ('=c', "\\'{c}", 'tex')
           call IMAP ('+c', "\\v{c}", 'tex')
           call IMAP ('=d', "\\'{d}", 'tex')
           call IMAP ('+d', "\\v{d}", 'tex')
           call IMAP ('=e', "\\'{e}", 'tex')
           call IMAP ('+e', "\\v{e}", 'tex')
           call IMAP ('=f', "\\'{f}", 'tex')
           call IMAP ('+f', "\\v{f}", 'tex')
           call IMAP ('=g', "\\'{g}", 'tex')
           call IMAP ('+g', "\\v{g}", 'tex')
           call IMAP ('=h', "\\'{h}", 'tex')
           call IMAP ('+h', "\\v{h}", 'tex')
           call IMAP ('=i', "\\'{\i}", 'tex')
           call IMAP ('+i', "\\v{\i}", 'tex')
           call IMAP ('=j', "\\'{j}", 'tex')
           call IMAP ('+j', "\\v{j}", 'tex')
           call IMAP ('=k', "\\'{k}", 'tex')
           call IMAP ('+k', "\\v{k}", 'tex')
           call IMAP ('=l', "\\'{l}", 'tex')
           call IMAP ('+l', "\\q l", 'tex')
           call IMAP ('=m', "\\'{m}", 'tex')
           call IMAP ('+m', "\\v{m}", 'tex')
           call IMAP ('=n', "\\'{n}", 'tex')
           call IMAP ('+n', "\\v{n}", 'tex')
           call IMAP ('=o', "\\'{o}", 'tex')
           call IMAP ('+o', "\\v{o}", 'tex')
           call IMAP ('+:', "\\^{o}", 'tex')
           call IMAP ('=p', "\\'{p}", 'tex')
           call IMAP ('+p', "\\v{p}", 'tex')
           call IMAP ('=q', "\\'{q}", 'tex')
           call IMAP ('+q', "\\v{q}", 'tex')
           call IMAP ('=r', "\\'{r}", 'tex')
           call IMAP ('+r', "\\v{r}", 'tex')
           call IMAP ('=s', "\\'{s}", 'tex')
           call IMAP ('+s', "\\v{s}", 'tex')
           call IMAP ('=t', "\\'{t}", 'tex')
           call IMAP ('+t', "\\q t", 'tex')
           call IMAP ('=u', "\\'{u}", 'tex')
           call IMAP ('+u', "\\v{u}", 'tex')
           call IMAP ('=v', "\\'{v}", 'tex')
           call IMAP ('+v', "\\v{v}", 'tex')
           call IMAP ('=w', "\\'{w}", 'tex')
           call IMAP ('+w', "\\v{w}", 'tex')
           call IMAP ('=x', "\\'{x}", 'tex')
           call IMAP ('+x', "\\v{x}", 'tex')
           call IMAP ('=y', "\\'{y}", 'tex')
           call IMAP ('+y', "\\v{y}", 'tex')
           call IMAP ('=z', "\\'{z}", 'tex')
           call IMAP ('+z', "\\v{z}", 'tex')
           call IMAP ('=A', "\\'{A}", 'tex')
           call IMAP ('+A', "\\v{A}", 'tex')
           call IMAP ('=B', "\\'{B}", 'tex')
           call IMAP ('+B', "\\v{B}", 'tex')
           call IMAP ('=C', "\\'{C}", 'tex')
           call IMAP ('+C', "\\v{C}", 'tex')
           call IMAP ('=D', "\\'{D}", 'tex')
           call IMAP ('+D', "\\v{D}", 'tex')
           call IMAP ('=E', "\\'{E}", 'tex')
           call IMAP ('+E', "\\v{E}", 'tex')
           call IMAP ('=F', "\\'{F}", 'tex')
           call IMAP ('+F', "\\v{F}", 'tex')
           call IMAP ('=G', "\\'{G}", 'tex')
           call IMAP ('+G', "\\v{G}", 'tex')
           call IMAP ('=H', "\\'{H}", 'tex')
           call IMAP ('+H', "\\v{H}", 'tex')
           call IMAP ('=I', "\\'{\I}", 'tex')
           call IMAP ('+I', "\\v{\I}", 'tex')
           call IMAP ('=J', "\\'{J}", 'tex')
           call IMAP ('+J', "\\v{J}", 'tex')
           call IMAP ('=K', "\\'{K}", 'tex')
           call IMAP ('+K', "\\v{K}", 'tex')
           call IMAP ('=L', "\\'{L}", 'tex')
           call IMAP ('+L', "\\v{L}", 'tex')
           call IMAP ('=M', "\\'{M}", 'tex')
           call IMAP ('+M', "\\v{M}", 'tex')
           call IMAP ('=N', "\\'{N}", 'tex')
           call IMAP ('+N', "\\v{N}", 'tex')
           call IMAP ('=O', "\\'{O}", 'tex')
           call IMAP ('+O', "\\v{O}", 'tex')
           call IMAP ('=P', "\\'{P}", 'tex')
           call IMAP ('+P', "\\v{P}", 'tex')
           call IMAP ('=Q', "\\'{Q}", 'tex')
           call IMAP ('+Q', "\\v{Q}", 'tex')
           call IMAP ('=R', "\\'{R}", 'tex')
           call IMAP ('+R', "\\v{R}", 'tex')
           call IMAP ('=S', "\\'{S}", 'tex')
           call IMAP ('+S', "\\v{S}", 'tex')
           call IMAP ('=T', "\\'{T}", 'tex')
           call IMAP ('+T', "\\v{T}", 'tex')
           call IMAP ('=U', "\\'{U}", 'tex')
           call IMAP ('+U', "\\v{U}", 'tex')
           call IMAP ('=V', "\\'{V}", 'tex')
           call IMAP ('+V', "\\v{V}", 'tex')
           call IMAP ('=W', "\\'{W}", 'tex')
           call IMAP ('+W', "\\v{W}", 'tex')
           call IMAP ('=X', "\\'{X}", 'tex')
           call IMAP ('+X', "\\v{X}", 'tex')
           call IMAP ('=Y', "\\'{Y}", 'tex')
           call IMAP ('+Y', "\\v{Y}", 'tex')
           call IMAP ('=Z', "\\'{Z}", 'tex')
           call IMAP ('+Z', "\\v{Z}", 'tex')
           " }}}
           " vmaps: enclose selected region in brackts, environments {{{
           vnoremap <Leader>( "rxi\left(<cr>\right)<cr><esc>k"rP
           vnoremap <Leader>[ "rxi\left[<cr>\right]<cr><esc>k"rP
           vnoremap <Leader>{ "rxi\left\{<cr>\right\}<cr><esc>k"rP
           vnoremap <Leader>v "rxi\begin{verbatim}<cr>\end{verbatim}<esc>k"rP
           vnoremap <Leader>c "rxi\begin{center}<cr>\end{center}<esc>k"rP
           " }}}
   end
   " }}}
   
   " RunLaTeX: compilation function {{{
   " this function runs the latex command on the currently open file. often times
   " the file being currently edited is only a fragment being \input'ed into some
   " master tex file. in this case, make a file called mainfile.latexmain in the
   " directory containig the file. in other words, if the current file is
   " ~/thesis/chapter.tex
   " so that doing "latex chapter.tex" doesnt make sense, then make a file called
   " main.tex.latexmain
   " in the ~/thesis directory. this will then run "latex main.tex" when
   " RunLaTeX() is called.
   function! RunLaTeX()
           if &ft != 'tex'
                   echo "calling RunLaTeX from a non-tex file"
                   return
           end
           let dir = expand("%:p:h").'/'
           let curd = getcwd()
           exec 'cd '.expand("%:p:h")
           if glob(dir.'*.latexmain') != ''
                   let lheadfile = glob(dir.'*.latexmain')
                   let mainfname = fnamemodify(lheadfile, ":t:r")
                   exec 'make '.mainfname
           else
                   make %
         endif          endif
         inoremap <buffer> <Plug>TexFormat <Esc>gqapi          cwindow
         noremap  <buffer> <Plug>TexFormat gqap          exec 'cd '.curd
         vnoremap <buffer> <Plug>TexFormat gq  endfunction
   
         imap <buffer> =a \'{a}  if !hasmapto('RunLaTeX')
         imap <buffer> +a \v{a}          if has("gui")
         imap <buffer> +} \"{a}                  nnoremap <buffer> <Leader>ll :silent! call RunLaTeX()<cr>
         imap <buffer> =b \'{b}          else
         imap <buffer> +b \v{b}                  nnoremap <buffer> <Leader>ll :call RunLaTeX()<cr>
         imap <buffer> =c \'{c}          end
         imap <buffer> +c \v{c}  end
         imap <buffer> =d \'{d}  
         imap <buffer> +d \v{d}  
         imap <buffer> =e \'{e}  
         imap <buffer> +e \v{e}  
         imap <buffer> =f \'{f}  
         imap <buffer> +f \v{f}  
         imap <buffer> =g \'{g}  
         imap <buffer> +g \v{g}  
         imap <buffer> =h \'{h}  
         imap <buffer> +h \v{h}  
         imap <buffer> =i \'{\i}  
         imap <buffer> +i \v{\i}  
         imap <buffer> =j \'{j}  
         imap <buffer> +j \v{j}  
         imap <buffer> =k \'{k}  
         imap <buffer> +k \v{k}  
         imap <buffer> =l \'{l}  
         imap <buffer> +l \q l  
         imap <buffer> =m \'{m}  
         imap <buffer> +m \v{m}  
         imap <buffer> =n \'{n}  
         imap <buffer> +n \v{n}  
         imap <buffer> =o \'{o}  
         imap <buffer> +o \v{o}  
         imap <buffer> +: \^{o}  
         imap <buffer> =p \'{p}  
         imap <buffer> +p \v{p}  
         imap <buffer> =q \'{q}  
         imap <buffer> +q \v{q}  
         imap <buffer> =r \'{r}  
         imap <buffer> +r \v{r}  
         imap <buffer> =s \'{s}  
         imap <buffer> +s \v{s}  
         imap <buffer> =t \'{t}  
         imap <buffer> +t \q t  
         imap <buffer> =u \'{u}  
         imap <buffer> +u \v{u}  
         imap <buffer> =v \'{v}  
         imap <buffer> +v \v{v}  
         imap <buffer> =w \'{w}  
         imap <buffer> +w \v{w}  
         imap <buffer> =x \'{x}  
         imap <buffer> +x \v{x}  
         imap <buffer> =y \'{y}  
         imap <buffer> +y \v{y}  
         imap <buffer> =z \'{z}  
         imap <buffer> +z \v{z}  
         imap <buffer> =A \'{A}  
         imap <buffer> +A \v{A}  
         imap <buffer> =B \'{B}  
         imap <buffer> +B \v{B}  
         imap <buffer> =C \'{C}  
         imap <buffer> +C \v{C}  
         imap <buffer> =D \'{D}  
         imap <buffer> +D \v{D}  
         imap <buffer> =E \'{E}  
         imap <buffer> +E \v{E}  
         imap <buffer> =F \'{F}  
         imap <buffer> +F \v{F}  
         imap <buffer> =G \'{G}  
         imap <buffer> +G \v{G}  
         imap <buffer> =H \'{H}  
         imap <buffer> +H \v{H}  
         imap <buffer> =I \'{\I}  
         imap <buffer> +I \v{\I}  
         imap <buffer> =J \'{J}  
         imap <buffer> +J \v{J}  
         imap <buffer> =K \'{K}  
         imap <buffer> +K \v{K}  
         imap <buffer> =L \'{L}  
         imap <buffer> +L \v{L}  
         imap <buffer> =M \'{M}  
         imap <buffer> +M \v{M}  
         imap <buffer> =N \'{N}  
         imap <buffer> +N \v{N}  
         imap <buffer> =O \'{O}  
         imap <buffer> +O \v{O}  
         imap <buffer> =P \'{P}  
         imap <buffer> +P \v{P}  
         imap <buffer> =Q \'{Q}  
         imap <buffer> +Q \v{Q}  
         imap <buffer> =R \'{R}  
         imap <buffer> +R \v{R}  
         imap <buffer> =S \'{S}  
         imap <buffer> +S \v{S}  
         imap <buffer> =T \'{T}  
         imap <buffer> +T \v{T}  
         imap <buffer> =U \'{U}  
         imap <buffer> +U \v{U}  
         imap <buffer> =V \'{V}  
         imap <buffer> +V \v{V}  
         imap <buffer> =W \'{W}  
         imap <buffer> +W \v{W}  
         imap <buffer> =X \'{X}  
         imap <buffer> +X \v{X}  
         imap <buffer> =Y \'{Y}  
         imap <buffer> +Y \v{Y}  
         imap <buffer> =Z \'{Z}  
         imap <buffer> +Z \v{Z}  
   
   
         " Greek letter, AucTex style bindings  
         " (inspiration from  
         " http://vim.sourceforge.net/scripts/download.php?src_id=416  
         " --  Carl Mueller)  
         inoremap <buffer> `a \alpha  
         inoremap <buffer> `b \beta  
         inoremap <buffer> `c \chi  
         inoremap <buffer> `d \delta  
         inoremap <buffer> `e \varepsilon  
         inoremap <buffer> `f \varphi  
         inoremap <buffer> `g \gamma  
         inoremap <buffer> `h \eta  
         inoremap <buffer> `i \int_{}^{}<Esc>3hi  
         " Or \iota or \infty or \in  
         inoremap <buffer> `k \kappa  
         inoremap <buffer> `l \lambda  
         inoremap <buffer> `m \mu  
         inoremap <buffer> `n \nu  
         inoremap <buffer> `o \omega  
         inoremap <buffer> `p \pi  
         inoremap <buffer> `q \theta  
         inoremap <buffer> `r \rho  
         inoremap <buffer> `s \sigma  
         inoremap <buffer> `t \tau  
         inoremap <buffer> `u \upsilon  
         inoremap <buffer> `v \vee  
         inoremap <buffer> `w \wedge  
         inoremap <buffer> `x \xi  
         inoremap <buffer> `y \psi  
         inoremap <buffer> `z \zeta  
         inoremap <buffer> `D \Delta  
         inoremap <buffer> `I \int_{}^{}<Esc>3hi  
         inoremap <buffer> `F \Phi  
         inoremap <buffer> `G \Gamma  
         inoremap <buffer> `L \Lambda  
         inoremap <buffer> `N \nabla  
         inoremap <buffer> `O \Omega  
         inoremap <buffer> `Q \Theta  
         inoremap <buffer> `R \varrho  
         inoremap <buffer> `S \sum_{}^{}<Esc>3hi  
         inoremap <buffer> `U \Upsilon  
         inoremap <buffer> `X \Xi  
         inoremap <buffer> `Y \Psi  
         inoremap <buffer> `0 \emptyset  
         inoremap <buffer> `1 \left  
         inoremap <buffer> `2 \right  
         inoremap <buffer> `3 \Big  
         inoremap <buffer> `6 \partial  
         inoremap <buffer> `8 \infty  
         inoremap <buffer> `/ \frac{}{}<Esc>2hi  
         inoremap <buffer> `% \frac{}{}<Esc>2hi  
         inoremap <buffer> `@ \circ  
         inoremap <buffer> `\| \Big\|  
         inoremap <buffer> `= \equiv  
         inoremap <buffer> `\ \setminus  
         inoremap <buffer> `. \cdot  
         inoremap <buffer> `* \times  
         inoremap <buffer> `& \wedge  
         inoremap <buffer> `- \bigcap  
         inoremap <buffer> `+ \bigcup  
         inoremap <buffer> `( \subset  
         inoremap <buffer> `) \supset  
         inoremap <buffer> `< \le  
         inoremap <buffer> `> \ge  
         inoremap <buffer> `, \nonumber  
         inoremap <buffer> `: \dots  
         inoremap <buffer> `~ \tilde{}<Left>  
         inoremap <buffer> `^ \hat{}<Left>  
         inoremap <buffer> `; \dot{}<Left>  
         inoremap <buffer> `_ \bar{}<Left>  
         " inoremap <buffer> `<M-c> \cos  
         " inoremap <buffer> `<C-E> \exp\left(\right)<Esc>6hi  
         " inoremap <buffer> `<C-I> \in  
         " inoremap <buffer> `<C-J> \downarrow  
         " inoremap <buffer> `<C-L> \log  
         " inoremap <buffer> `<C-P> \uparrow  
         " inoremap <buffer> `<Up> \uparrow  
         " inoremap <buffer> `<C-N> \downarrow  
         " inoremap <buffer> `<Down> \downarrow  
         " inoremap <buffer> `<C-F> \to  
         " inoremap <buffer> `<Right> \lim_{}<Left>  
         " inoremap <buffer> `<C-S> \sin  
         " inoremap <buffer> `<C-T> \tan  
         " inoremap <buffer> `<M-l> \ell  
         " inoremap <buffer> `<CR> \nonumber\\<CR>  
   
         " Map <BS> to delete "\'{a}" as one character.  
         " To avoid complications (start of line, end of line, etc.) the  
         " mapping inserts a character, the function deletes all but two  
         " characters, and the mapping deletes the last two.  
         inoremap <buffer> <BS> x<Esc>:call <SID>SmartBS()<CR>a<BS><BS>  
   
 endif  " }}}
 " }}} end mappings  " set up the latex compiler {{{
   if filereadable(expand('<sfile>:p:h:h').'/compiler/tex.vim')
           exe "source ".expand('<sfile>:p:h:h')."/compiler/tex.vim"
   else
           runtime! compiler/tex.vim
   end
   " }}}
   
   " -----------------------------------------------------------------------------
   " Smart functions
   " -----------------------------------------------------------------------------
   
   " TexQuotes: inserts `` or '' instead of " {{{
   " the functions in this section taken from auctex.vim
   " Smart quotes.  Thanks to Ron Aaron <ron@mossbayeng.com>.
   " typing " after whitespace results in `` otherwise ''
   function! s:TexQuotes()
           let s:insert = "''"
           let s:left = getline(line("."))[col(".")-2]
           if s:left == ' ' || s:left == '' || s:left == ' '   " Tab
                   let s:insert = '``'
           elseif s:left == '\'
                   let s:insert = '"'
           endif
           return s:insert
   endfunction
   imap <buffer> " <C-R>=<SID>TexQuotes()<CR>
   " }}}
   " SmartBS: smart backspacing {{{
 let g:smartBS_tex = '\(' .  let g:smartBS_tex = '\(' .
                         \ "\\\\[\"^'=v]{\\S}"      . '\|' .                          \ "\\\\[\"^'=v]{\\S}"      . '\|' .
                         \ "\\\\[\"^'=]\\S"         . '\|' .                          \ "\\\\[\"^'=]\\S"         . '\|' .
Line 327  fun! s:SmartBS()
Line 462  fun! s:SmartBS()
     execute "normal!" . len . "X"      execute "normal!" . len . "X"
   endif    endif
 endfun  endfun
   inoremap <buffer> <BS> x<Esc>:call <SID>SmartBS()<CR>a<BS><BS>
   " }}}
   
   " MakeTexFolds: see ../plugin/syntaxFolds.vim for documentation {{{
   function! MakeTexFolds(force)
   
 " Modeline {{{          " the order in which these calls are made decides the nestedness. in
 " vim:set ts=4:          " latex, a table environment will always be embedded in either an item or
 " vim600:fdm=marker fdl=0 fdc=3 vb t_vb=:          " a section etc. not the other way around. so we first fold up all the
           " tables. and then proceed with the other regions.
           let b:startPat_1 = '^\s*\\begin{table}'
           let b:endPat_1 = '^\s*\\end{table}'
           let b:startOff_1 = 0
           let b:endOff_1 = 0
   
           let b:startPat_2 = '^\s*\\begin{figure}'
           let b:endPat_2 = '^\s*\\end{figure}'
           let b:startOff_2 = 0
           let b:endOff_2 = 0
   
           let b:startPat_3 = '^\s*\\begin{eq'
           let b:endPat_3 = '^\s*\\end{eq'
           let b:startOff_3 = 0
           let b:endOff_3 = 0
   
           " both versions for taking care of nestedness of the itemize environments
           " work, but the lower one is more general and results in greater
           " recursion.
           let b:startPat_4 = '^\s*\\item'
           let b:endPat_4 = '^\s*\\item\|^\s*\\end{\(enumerate\|itemize\|description\)}'
           let b:startOff_4 = 0
           let b:endOff_4 = -1
           let b:skipStartPat_4 = '^\s*\\begin{\(enumerate\|itemize\)}'
           " let b:skipStartPat_4 = '^\s*\\begin'
           let b:skipEndPat_4 = '^\s*\\end'
   
           let b:startPat_5 = '^\s*\\subsubsection'
           let b:endPat_5 = '^\s*\\section\|^\s*\\subsection\|^\s*\\subsubsection'
           let b:startOff_5 = 0
           let b:endOff_5 = -1
   
           let b:startPat_6 = '^\s*\\subsection'
           let b:endPat_6 = '^\s*\\section\|^\s*\\subsection'
           let b:startOff_6 = 0
           let b:endOff_6 = -1
   
           let b:startPat_7 = '^\s*\\section'
           let b:endPat_7 = '^\s*\\section'
           let b:startOff_7 = 0
           let b:endOff_7 = -1
   
           let b:startPat_8 = '^\s*\\chapter'
           let b:endPat_8 = '^\s*\\section'
           let b:startOff_8 = 0
           let b:endOff_8 = -1
   
           call MakeSyntaxFolds(a:force)
   endfunction
 " }}}  " }}}
   
   " TexFoldTextFunction: see ../plugin/syntaxFolds.vim for documentation {{{
   function! TexFoldTextFunction()
           if getline(v:foldstart) =~ '^\s*\\begin{'
                   let header = matchstr(getline(v:foldstart), '^\s*\\begin{\zs[^}]*\ze}')
   
                   let caption = ''
                   let label = ''
                   let i = v:foldstart
                   while i <= v:foldend
                           if getline(i) =~ '^\s*\\caption'
                                   let caption = matchstr(getline(i), '\\caption{\zs.*\ze}')
                           elseif getline(i) =~ '\\label'
                                   let label = matchstr(getline(i), '\\label{\zs.*\ze}')
                           end
   
                           let i = i + 1
                   endwhile
   
                   let ftxto = foldtext()
   
                   let retText = matchstr(ftxto, '^[^:]*').': '.header.' ('.label.') : '.caption
                   return retText
           else
                   return foldtext()
           end
   endfunction
   " }}}
   
   " source other related files.
   exe "so ".expand('<sfile>:p:h').'/miktexmenus.vim'
   
   " TEX_ShowVariableValue: debugging help {{{
   " provides a way to examine script local variables from outside the script.
   " very handy for debugging.
   function! TEX_ShowVariableValue(...)
           let i = 1
           while i <= a:0
                   exe 'let arg = a:'.i
                   if exists('s:'.arg) ||
                   \  exists('*s:'.arg)
                           exe 'let val = s:'.arg
                           echomsg 's:'.arg.' = '.val
                   end
                   let i = i + 1
           endwhile
   endfunction
   
   " }}}
   
   augroup TeXFolds
           au!
           au FileType tex :set foldtext=TexFoldTextFunction()
           au FileType tex :call MakeTexFolds(0)
       au FileType tex :if mapcheck('<F6>') == ""
                                   \ | exe ':nnoremap <buffer> <F6> :call MakeTexFolds(1)<cr>'
                                   \ | endif
           au FileType tex :nnoremap <buffer> <leader>rf :call MakeTexFolds(1)<cr>
   augroup END
   
   augroup VIMFolds
           au!
       au FileType vim :if mapcheck('<F6>') == ""
                                   \ | exe ':nnoremap <buffer> <F6> :call MakeVimFolds(1)<cr>'
                                   \ | endif
   augroup END
   
   " vim:set ts=4:
   " vim600:fdm=marker fdl=0 fdc=3 nowrap:

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12

Platon Group <platon@platon.org> http://platon.org/
Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top