Easytags -> bundle (Careful: Notes is now depending on it!)
[my-vim-dotfolder.git] / ftplugin / tex_atp.vim
blob141b75ada07eebccba27a4c925f12c0280584804
1 " Title:                Vim filetype plugin file
2 " Author:               Marcin Szamotulski
3 " Email:                mszamot [AT] gmail [DOT] com
4 " URL:                  https://launchpad.net/automatictexplugin        
5 " BUG Trucer:   https://bugs.launchpad.net/automatictexplugin
6 " Language:             tex
7 " Last Changed: 7 October 2010
8 " GetLatestVimScripts: 2945 50 :AutoInstall: tex_atp.vim
9 " GetLatestVimScripts: 884 1 :AutoInstall: AutoAlign.vim
10 " Copyright Statement: 
11 "         This file is part of Automatic Tex Plugin for Vim.
13 "     Automatic Tex Plugin for Vim is free software: you can redistribute it
14 "     and/or modify it under the terms of the GNU General Public License as
15 "     published by the Free Software Foundation, either version 3 of the
16 "     License, or (at your option) any later version.
17
18 "     Automatic Tex Plugin for Vim is distributed in the hope that it will be
19 "     useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
20 "     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
21 "     General Public License for more details.
22
23 "     You should have received a copy of the GNU General Public License along
24 "     with Automatic Tex Plugin for Vim.  If not, see <http://www.gnu.org/licenses/>.
26 "     This licence applies to all files shipped with Automatic Tex Plugin.
28 let b:did_ftplugin      = 1
30 let g:atp_debugMainScript = 0
31                         " This gives loading time information for debuging purposes.
32                         " The sourcing of vim scripts is more complicated than this but,
33                         " at least, this gives some info.
34                         " Loading times are also acessible using
35                         "       vim --startuptime /tmp/time
36                         " see :h --startuptime
37 if g:atp_debugMainScript
38         redir! >> /tmp/ATP_log
39         silent! echo "+++ FILE: " . expand("%")
40         let time = reltime()
41         let g:time = time
42 endif
44 if &cpoptions =~ '<'
45         echohl WarningMsg
46         echo "ATP is removing < from cpoptions"
47         echohl None
48         setl cpoptions-=<
49 endif
50         let rtp = join(map(split(&rtp, ','), 'fnameescape(v:val)'), ',')
53         " Execute the atprc file.
54         " They override cached variables
55         if filereadable(globpath($HOME, '/.atprc.vim', 1)) && has("unix")
57                 " Note: in $HOME/.atprc file the user can set all the local buffer
58                 " variables without using autocommands
59                 let path = fnameescape(globpath($HOME, '/.atprc.vim', 1))
60                 execute 'source ' . path
62         else
63                 let path        = get(split(globpath(&rtp, "**/ftplugin/ATP_files/atprc.vim"), '\n'), 0, "")
64                 if path != ""
65                         execute 'source ' . path
66                 endif
67         endif
69                 if g:atp_debugMainScript
70                         let g:atprc_loadtime=str2float(reltimestr(reltime(time)))
71                         silent echo "rc loadtime:        " . string(g:atprc_loadtime)
72                 endif
74         " Source Project Script
75         let s:project_src       = findfile("ftplugin/ATP_files/project.vim", rtp) 
76         execute 'source '       . fnameescape(s:project_src)
78                 if g:atp_debugMainScript
79                         let g:atphist_loadtime=str2float(reltimestr(reltime(time)))-g:atprc_loadtime
80                         silent echo "project loadtime:   " . string(g:atphist_loadtime)
81                 endif
83         " Functions needed before setting options.
84         let s:common_src        = findfile("ftplugin/ATP_files/common.vim", rtp) 
85         execute 'source '       . fnameescape(s:common_src)
87                 if g:atp_debugMainScript
88                         let g:atpcom_loadtime=str2float(reltimestr(reltime(time)))-g:atprc_loadtime
89                         silent echo "com loadtime:       " . string(g:atpcom_loadtime)
90                 endif
92         " Options, global and local variables, autocommands.
93         let s:options_src       = findfile("ftplugin/ATP_files/options.vim", rtp) 
94         execute 'source '       . fnameescape(s:options_src)
96                 if g:atp_debugMainScript
97                         let g:atpopt_loadtime=str2float(reltimestr(reltime(time)))-g:atpcom_loadtime
98                         silent echo "opt loadtime:       " . string(g:atpopt_loadtime)
99                 endif
102         " Compilation related stuff.
103         let s:compiler_src      = findfile("ftplugin/ATP_files/compiler.vim", rtp) 
104         execute 'source '       . fnameescape(s:compiler_src)
106                 if g:atp_debugMainScript
107                         let g:atpcomp_loadtime=str2float(reltimestr(reltime(time)))-g:atpopt_loadtime
108                         silent echo "comp loadtime:      " . string(g:atpcomp_loadtime)
109                 endif
111 "       let compiler_file = findfile('compiler/tex_atp.vim', &rtp)
112 "       if compiler_file
113 "               execute 'source '       . fnameescape(compiler_file)
114 "       endif
116         " LatexBox addons (by D.Munger, with some modifications).
117         if g:atp_LatexBox
119                 let s:LatexBox_common_src               = findfile("ftplugin/ATP_files/LatexBox_common.vim", rtp) 
120                 execute 'source ' . fnameescape(s:LatexBox_common_src)
122                 let s:LatexBox_complete_src     = findfile("ftplugin/ATP_files/LatexBox_complete.vim", rtp) 
123                 execute 'source ' . fnameescape(s:LatexBox_complete_src)
125                 let s:LatexBox_motion_src               = findfile("ftplugin/ATP_files/LatexBox_motion.vim", rtp) 
126                 execute 'source ' . fnameescape(s:LatexBox_motion_src)
128                 let s:LatexBox_latexmk_src              = findfile("ftplugin/ATP_files/LatexBox_latexmk.vim", rtp) 
129                 execute 'source ' . fnameescape(s:LatexBox_latexmk_src)
130         endif
132                 if g:atp_debugMainScript
133                         let g:atpLB_loadtime=str2float(reltimestr(reltime(time)))-g:atpcomp_loadtime
134                         silent echo "LB loadtime:        " . string(g:atpLB_loadtime)
135                 endif
138         let s:motion_src        = findfile("ftplugin/ATP_files/motion.vim", rtp) 
139         execute 'source ' . fnameescape(s:motion_src)
141                 if g:atp_debugMainScript
142                         let g:atpmot_loadtime=str2float(reltimestr(reltime(time)))-g:atpLB_loadtime
143                         silent echo "mot loadtime:       " . string(g:atpmot_loadtime)
144                 endif
146         let s:search_src        = findfile("ftplugin/ATP_files/search.vim", rtp) 
147         execute 'source ' . fnameescape(s:search_src)
149                 if g:atp_debugMainScript
150                         let g:atpsea_loadtime=str2float(reltimestr(reltime(time)))-g:atpmot_loadtime
151                         silent echo "sea loadtime:       " . string(g:atpsea_loadtime)
152                 endif
154         let s:various_src       = findfile("ftplugin/ATP_files/various.vim", rtp) 
155         execute 'source ' . fnameescape(s:various_src)
157                 if g:atp_debugMainScript
158                         let g:atpvar_loadtime=str2float(reltimestr(reltime(time)))-g:atpsea_loadtime
159                         silent echo "var loadtime:       " . string(g:atpvar_loadtime)
160                 endif
163         " Source maps and menu files.
164         let s:mappings_src      = findfile("ftplugin/ATP_files/mappings.vim", rtp) 
165         execute 'source ' . fnameescape(s:mappings_src)
167         if g:atp_LatexBox
169                 " LatexBox mappings.
170                 let s:LatexBox_mappings_src             = findfile("ftplugin/ATP_files/LatexBox_mappings.vim", rtp) 
171                 execute 'source ' . fnameescape(s:LatexBox_mappings_src)
172                         
173         endif
175                 if g:atp_debugMainScript
176                         let g:atpmap_loadtime=str2float(reltimestr(reltime(time)))-g:atpvar_loadtime
177                         silent echo "map loadtime:       " . string(g:atpmap_loadtime)
178                 endif
180         " The menu.
181         let s:menu_src  = findfile("ftplugin/ATP_files/menu.vim", rtp) 
182         execute 'source ' . fnameescape(s:menu_src)
184                 if g:atp_debugMainScript
185                         let g:atpmenu_loadtime=str2float(reltimestr(reltime(time)))-g:atpmap_loadtime
186                         silent echo "menu loadtime:      " . string(g:atpmenu_loadtime)
187                 endif
189         " Help functions.
190         let s:help_src  = findfile("ftplugin/ATP_files/helpfunctions.vim", rtp) 
191         execute 'source ' . fnameescape(s:help_src)
193                 if g:atp_debugMainScript
194                         let g:atphelp_loadtime=str2float(reltimestr(reltime(time)))-g:atpmenu_loadtime
195                         silent echo "help loadtime:      " . string(g:atphelp_loadtime)
196                 endif
199                 if g:atp_debugMainScript
200                         let g:atp_loadtime =  str2float(reltimestr(reltime(time)))
201                         silent echo "LOADTIME:           " . string(g:atp_loadtime)
202                         redir END
203                 endif
207 " vim:fdm=marker:ff=unix:noet:ts=4:sw=4