My fork of the vim-latex
plugin.
An inexhaustive description of what I've changed:
-
The bulk of the functions are moved to scripts in
autoload/tex/. For the most part,autoloadscript files correspond to those underftplugin/latex-suite/in the original, but I've shortened names here and there. -
Global variables in the original become script variables in the
autoloadscripts here, and theftpluginnow exclusively sets buffer variables. Eachautoloadscript is to open with a segment in which theftpluginbuffer variable corresponding to each script variable is checked; if it exists/is populated, then the script variable is given the buffer value. This code looks as follows:if exists("b:tex_<param>") let s:<param> = b:tex_<param> else let s:<param> = <default_global_val> endifI haven't yet fulfilled this everywhere.
-
Rules for compiling to a particular target file type are to be located in scripts with names like
tex2<targ>.vimundercompiler/as much as practicable. Buffer variables may be used here for runtime customization, and some may be set here. When theftpluginis loaded, these compiling rules can then be set via thevimcommand:compiler.I've only done this for the
pdftarget so far, and the script is a bit messy. -
The
IMAPplugin is not specific to thetexfile type, hence should be, in my humble opinion, a standalone plugin. I've accordingly removed it from my forked ftplugin.
-
Compiling/Viewing: I've rewritten what was mostly contained in
Tex_RunLatex(),Tex_CompileLatex()andTex_CompileMultipleTimes(), and made some changes to what was inTex_ViewLatex()—partly to speed things up (which I may or may not have achieved), partly to take advantage of more of whatpdflatexcan do, and partly to avoid running steps which are unnecessary in a particular instance. In particular:-
The code is now aware of the use of the
-output-directoryand-jobnameoptions forpdflatexvia the vim settingsb:tex_outpdirandb:tex_jobnm, resp. -
Nothing is done if the
texfile (which is now written to right at the start of the process) is older than its associatedauxfile.
The BibLaTeX "backend" (biberby default) is only run if thebcffile is updated, and it gets its input/output frompdflatex's output directory if applicable. -
The
autoloadfunctiontex#compiler#View()(replacingTex_ViewLatex()) opens the target file frompdflatex's output directory if applicable.
-
-
imaps: TheIMAPplugin provided with the original ftplugin is great, and I continue employing it for a number of things in this fork (with the goal of eventually removing it entirely), but mostLaTeXconstructs it just isn't exactly to my taste. I've added my ownautoloadcode intex/imap.vimto provide what I call "runningimaps", i.e. those which operate on multiple consecutive characters while allowing those characters to be printed normally. My way of implementing this fires the mapping when one of a small set of triggering characters is typed:<space>,<tab>or<cr>at the moment. This contrasts withIMAP's mapping of every character which terminates some mapped sequence.
I've jettisoned a few helper functions and restructured some things along the way. I may come to regret doing so, but I'd like to see how far I simplify things.
-
Moving code under
autoload/tex/obviates the use of the prefixTex_from the original ftplugin to avoid naming collisions with other plugins. Such a prefix should be retained, however, for all buffer variables and for any functions which for some reason need to be kept at theftpluginlevel.I haven't yet removed that prefix across all the code.
-
I like my variables to begin in lowercase, so the buffer variables holding the ftplugin's settings look like
b:tex_<lowercase_char><rest_of_name>. As for the rest, I'm very indecisive; what I've got is a mix of camelCase, underscores and stuff crammed into single "words". I really ought to come up with a convention for this.
Writing debugging messages is to be triggered based on a debugging level,
b:tex_debuglvl, and on a bitwise match between the overall debugging
flag, b:tex_debugflg, and a "code module" flag of the form
tex#lib#debugflg_<script_name> specific to a particular autoload
script. The overall debugging flag, b:tex_debugflg, is set by bitwise
OR'ing together the module flags for all of the scripts one wishes to
debug, and then this is matched for debugging calls to tex#lib#debug()
via a bitwise AND. Such a call is coded as follows:
if (b:tex_debuglvl >= <lvl>) && and(b:tex_debugflg, tex#lib#debugflg_<script_name>)
call tex#lib#debug(<msg>)
endif
Here "<script_name>" is the name of the autoload script in which this
call resides, and "<lvl>" and "<msg>" are determined on a per-case
basis.
"Code modules" may need to come to mean categories of autoload scripts
(ideally grouped in folders) if the number of scripts were ever to get very
large.
-
This fork is horrifyingly lacking in documentation and code comments, and files have lost their header text (giving info such as authorship, licensing, etc.) in the shuffling.
-
Finish renaming things. (Cf. Naming)
-
Pull out the remaining uses of the
IMAPplugin. Users should be able to enableIMAPindependently of this ftplugin. -
Probably all functionality which I don't use has been broken by my changes and I just don't know it yet. These bugs will need to be tested for and fixed.