From e5dfb045b994e1ab8fef9ef5d3f02ce20ea6b685 Mon Sep 17 00:00:00 2001 From: Ryan Kavanagh Date: Mon, 13 Dec 2021 16:55:42 -0500 Subject: many more renames --- dot_vim/ftplugin/latex-suite/bibtex.vim | 266 +++++ dot_vim/ftplugin/latex-suite/bibtools.py | 221 ++++ dot_vim/ftplugin/latex-suite/bibtools.pyc | Bin 0 -> 7004 bytes dot_vim/ftplugin/latex-suite/brackets.vim | 145 +++ dot_vim/ftplugin/latex-suite/compiler.vim | 820 ++++++++++++++ dot_vim/ftplugin/latex-suite/custommacros.vim | 257 +++++ dot_vim/ftplugin/latex-suite/diacritics.vim | 124 +++ dot_vim/ftplugin/latex-suite/dictionaries/SIunits | 289 +++++ .../ftplugin/latex-suite/dictionaries/dictionary | 677 ++++++++++++ dot_vim/ftplugin/latex-suite/elementmacros.vim | 338 ++++++ dot_vim/ftplugin/latex-suite/envmacros.vim | 1167 ++++++++++++++++++++ dot_vim/ftplugin/latex-suite/folding.vim | 393 +++++++ dot_vim/ftplugin/latex-suite/macros/example | 11 + dot_vim/ftplugin/latex-suite/main.vim | 1024 +++++++++++++++++ dot_vim/ftplugin/latex-suite/mathmacros-utf.vim | 729 ++++++++++++ dot_vim/ftplugin/latex-suite/mathmacros.vim | 730 ++++++++++++ dot_vim/ftplugin/latex-suite/multicompile.vim | 17 + dot_vim/ftplugin/latex-suite/outline.py | 186 ++++ dot_vim/ftplugin/latex-suite/outline.pyc | Bin 0 -> 4324 bytes dot_vim/ftplugin/latex-suite/packages.vim | 669 +++++++++++ dot_vim/ftplugin/latex-suite/packages/SIunits | 315 ++++++ dot_vim/ftplugin/latex-suite/packages/accents | 28 + dot_vim/ftplugin/latex-suite/packages/acromake | 10 + dot_vim/ftplugin/latex-suite/packages/afterpage | 10 + dot_vim/ftplugin/latex-suite/packages/alltt | 12 + dot_vim/ftplugin/latex-suite/packages/amsmath | 106 ++ dot_vim/ftplugin/latex-suite/packages/amsthm | 21 + dot_vim/ftplugin/latex-suite/packages/amsxtra | 12 + dot_vim/ftplugin/latex-suite/packages/arabic | 10 + dot_vim/ftplugin/latex-suite/packages/array | 17 + dot_vim/ftplugin/latex-suite/packages/babel | 98 ++ dot_vim/ftplugin/latex-suite/packages/bar | 27 + dot_vim/ftplugin/latex-suite/packages/bm | 10 + dot_vim/ftplugin/latex-suite/packages/bophook | 12 + .../ftplugin/latex-suite/packages/boxedminipage | 10 + dot_vim/ftplugin/latex-suite/packages/caption2 | 43 + dot_vim/ftplugin/latex-suite/packages/cases | 12 + dot_vim/ftplugin/latex-suite/packages/ccaption | 20 + dot_vim/ftplugin/latex-suite/packages/changebar | 35 + dot_vim/ftplugin/latex-suite/packages/chapterbib | 24 + dot_vim/ftplugin/latex-suite/packages/cite | 32 + dot_vim/ftplugin/latex-suite/packages/color | 43 + dot_vim/ftplugin/latex-suite/packages/comma | 12 + dot_vim/ftplugin/latex-suite/packages/deleq | 36 + dot_vim/ftplugin/latex-suite/packages/drftcite | 29 + dot_vim/ftplugin/latex-suite/packages/dropping | 12 + dot_vim/ftplugin/latex-suite/packages/enumerate | 10 + dot_vim/ftplugin/latex-suite/packages/eqlist | 19 + dot_vim/ftplugin/latex-suite/packages/eqparbox | 12 + dot_vim/ftplugin/latex-suite/packages/everyshi | 10 + dot_vim/ftplugin/latex-suite/packages/exmpl | 55 + dot_vim/ftplugin/latex-suite/packages/flafter | 10 + dot_vim/ftplugin/latex-suite/packages/float | 16 + dot_vim/ftplugin/latex-suite/packages/floatflt | 12 + dot_vim/ftplugin/latex-suite/packages/fn2end | 10 + dot_vim/ftplugin/latex-suite/packages/footmisc | 21 + dot_vim/ftplugin/latex-suite/packages/geometry | 93 ++ dot_vim/ftplugin/latex-suite/packages/german | 12 + dot_vim/ftplugin/latex-suite/packages/graphicx | 69 ++ dot_vim/ftplugin/latex-suite/packages/graphpap | 10 + dot_vim/ftplugin/latex-suite/packages/harpoon | 18 + dot_vim/ftplugin/latex-suite/packages/hhline | 21 + dot_vim/ftplugin/latex-suite/packages/histogram | 13 + dot_vim/ftplugin/latex-suite/packages/hyperref | 167 +++ dot_vim/ftplugin/latex-suite/packages/ifthen | 21 + dot_vim/ftplugin/latex-suite/packages/inputenc | 29 + dot_vim/ftplugin/latex-suite/packages/letterspace | 10 + dot_vim/ftplugin/latex-suite/packages/lineno | 60 + dot_vim/ftplugin/latex-suite/packages/longtable | 35 + dot_vim/ftplugin/latex-suite/packages/lscape | 10 + dot_vim/ftplugin/latex-suite/packages/manyfoot | 15 + dot_vim/ftplugin/latex-suite/packages/moreverb | 28 + dot_vim/ftplugin/latex-suite/packages/multibox | 10 + dot_vim/ftplugin/latex-suite/packages/multicol | 21 + dot_vim/ftplugin/latex-suite/packages/newalg | 26 + dot_vim/ftplugin/latex-suite/packages/ngerman | 10 + dot_vim/ftplugin/latex-suite/packages/numprint | 18 + dot_vim/ftplugin/latex-suite/packages/oldstyle | 12 + dot_vim/ftplugin/latex-suite/packages/outliner | 19 + dot_vim/ftplugin/latex-suite/packages/overcite | 34 + dot_vim/ftplugin/latex-suite/packages/parallel | 15 + dot_vim/ftplugin/latex-suite/packages/plain | 10 + dot_vim/ftplugin/latex-suite/packages/plates | 16 + dot_vim/ftplugin/latex-suite/packages/polski | 165 +++ dot_vim/ftplugin/latex-suite/packages/psgo | 27 + dot_vim/ftplugin/latex-suite/packages/schedule | 20 + dot_vim/ftplugin/latex-suite/packages/textfit | 12 + dot_vim/ftplugin/latex-suite/packages/times | 10 + dot_vim/ftplugin/latex-suite/packages/tipa | 364 ++++++ dot_vim/ftplugin/latex-suite/packages/ulem | 21 + dot_vim/ftplugin/latex-suite/packages/url | 24 + dot_vim/ftplugin/latex-suite/packages/verbatim | 18 + dot_vim/ftplugin/latex-suite/packages/version | 12 + dot_vim/ftplugin/latex-suite/projecttemplate.vim | 11 + dot_vim/ftplugin/latex-suite/pytools.py | 52 + dot_vim/ftplugin/latex-suite/smartspace.vim | 102 ++ dot_vim/ftplugin/latex-suite/templates.vim | 149 +++ .../ftplugin/latex-suite/templates/IEEEtran.tex | 142 +++ dot_vim/ftplugin/latex-suite/templates/article.tex | 9 + dot_vim/ftplugin/latex-suite/templates/report.tex | 9 + .../latex-suite/templates/report_two_column.tex | 9 + dot_vim/ftplugin/latex-suite/texmenuconf.vim | 131 +++ dot_vim/ftplugin/latex-suite/texproject.vim | 54 + dot_vim/ftplugin/latex-suite/texrc | 738 +++++++++++++ dot_vim/ftplugin/latex-suite/texviewer.vim | 1052 ++++++++++++++++++ dot_vim/ftplugin/latex-suite/version.vim | 30 + dot_vim/ftplugin/latex-suite/wizardfuncs.vim | 377 +++++++ 107 files changed, 13574 insertions(+) create mode 100644 dot_vim/ftplugin/latex-suite/bibtex.vim create mode 100644 dot_vim/ftplugin/latex-suite/bibtools.py create mode 100644 dot_vim/ftplugin/latex-suite/bibtools.pyc create mode 100644 dot_vim/ftplugin/latex-suite/brackets.vim create mode 100644 dot_vim/ftplugin/latex-suite/compiler.vim create mode 100644 dot_vim/ftplugin/latex-suite/custommacros.vim create mode 100644 dot_vim/ftplugin/latex-suite/diacritics.vim create mode 100644 dot_vim/ftplugin/latex-suite/dictionaries/SIunits create mode 100644 dot_vim/ftplugin/latex-suite/dictionaries/dictionary create mode 100644 dot_vim/ftplugin/latex-suite/elementmacros.vim create mode 100644 dot_vim/ftplugin/latex-suite/envmacros.vim create mode 100644 dot_vim/ftplugin/latex-suite/folding.vim create mode 100644 dot_vim/ftplugin/latex-suite/macros/example create mode 100644 dot_vim/ftplugin/latex-suite/main.vim create mode 100644 dot_vim/ftplugin/latex-suite/mathmacros-utf.vim create mode 100644 dot_vim/ftplugin/latex-suite/mathmacros.vim create mode 100644 dot_vim/ftplugin/latex-suite/multicompile.vim create mode 100644 dot_vim/ftplugin/latex-suite/outline.py create mode 100644 dot_vim/ftplugin/latex-suite/outline.pyc create mode 100644 dot_vim/ftplugin/latex-suite/packages.vim create mode 100644 dot_vim/ftplugin/latex-suite/packages/SIunits create mode 100644 dot_vim/ftplugin/latex-suite/packages/accents create mode 100644 dot_vim/ftplugin/latex-suite/packages/acromake create mode 100644 dot_vim/ftplugin/latex-suite/packages/afterpage create mode 100644 dot_vim/ftplugin/latex-suite/packages/alltt create mode 100644 dot_vim/ftplugin/latex-suite/packages/amsmath create mode 100644 dot_vim/ftplugin/latex-suite/packages/amsthm create mode 100644 dot_vim/ftplugin/latex-suite/packages/amsxtra create mode 100644 dot_vim/ftplugin/latex-suite/packages/arabic create mode 100644 dot_vim/ftplugin/latex-suite/packages/array create mode 100644 dot_vim/ftplugin/latex-suite/packages/babel create mode 100644 dot_vim/ftplugin/latex-suite/packages/bar create mode 100644 dot_vim/ftplugin/latex-suite/packages/bm create mode 100644 dot_vim/ftplugin/latex-suite/packages/bophook create mode 100644 dot_vim/ftplugin/latex-suite/packages/boxedminipage create mode 100644 dot_vim/ftplugin/latex-suite/packages/caption2 create mode 100644 dot_vim/ftplugin/latex-suite/packages/cases create mode 100644 dot_vim/ftplugin/latex-suite/packages/ccaption create mode 100644 dot_vim/ftplugin/latex-suite/packages/changebar create mode 100644 dot_vim/ftplugin/latex-suite/packages/chapterbib create mode 100644 dot_vim/ftplugin/latex-suite/packages/cite create mode 100644 dot_vim/ftplugin/latex-suite/packages/color create mode 100644 dot_vim/ftplugin/latex-suite/packages/comma create mode 100644 dot_vim/ftplugin/latex-suite/packages/deleq create mode 100644 dot_vim/ftplugin/latex-suite/packages/drftcite create mode 100644 dot_vim/ftplugin/latex-suite/packages/dropping create mode 100644 dot_vim/ftplugin/latex-suite/packages/enumerate create mode 100644 dot_vim/ftplugin/latex-suite/packages/eqlist create mode 100644 dot_vim/ftplugin/latex-suite/packages/eqparbox create mode 100644 dot_vim/ftplugin/latex-suite/packages/everyshi create mode 100644 dot_vim/ftplugin/latex-suite/packages/exmpl create mode 100644 dot_vim/ftplugin/latex-suite/packages/flafter create mode 100644 dot_vim/ftplugin/latex-suite/packages/float create mode 100644 dot_vim/ftplugin/latex-suite/packages/floatflt create mode 100644 dot_vim/ftplugin/latex-suite/packages/fn2end create mode 100644 dot_vim/ftplugin/latex-suite/packages/footmisc create mode 100644 dot_vim/ftplugin/latex-suite/packages/geometry create mode 100644 dot_vim/ftplugin/latex-suite/packages/german create mode 100644 dot_vim/ftplugin/latex-suite/packages/graphicx create mode 100644 dot_vim/ftplugin/latex-suite/packages/graphpap create mode 100644 dot_vim/ftplugin/latex-suite/packages/harpoon create mode 100644 dot_vim/ftplugin/latex-suite/packages/hhline create mode 100644 dot_vim/ftplugin/latex-suite/packages/histogram create mode 100644 dot_vim/ftplugin/latex-suite/packages/hyperref create mode 100644 dot_vim/ftplugin/latex-suite/packages/ifthen create mode 100644 dot_vim/ftplugin/latex-suite/packages/inputenc create mode 100644 dot_vim/ftplugin/latex-suite/packages/letterspace create mode 100644 dot_vim/ftplugin/latex-suite/packages/lineno create mode 100644 dot_vim/ftplugin/latex-suite/packages/longtable create mode 100644 dot_vim/ftplugin/latex-suite/packages/lscape create mode 100644 dot_vim/ftplugin/latex-suite/packages/manyfoot create mode 100644 dot_vim/ftplugin/latex-suite/packages/moreverb create mode 100644 dot_vim/ftplugin/latex-suite/packages/multibox create mode 100644 dot_vim/ftplugin/latex-suite/packages/multicol create mode 100644 dot_vim/ftplugin/latex-suite/packages/newalg create mode 100644 dot_vim/ftplugin/latex-suite/packages/ngerman create mode 100644 dot_vim/ftplugin/latex-suite/packages/numprint create mode 100644 dot_vim/ftplugin/latex-suite/packages/oldstyle create mode 100644 dot_vim/ftplugin/latex-suite/packages/outliner create mode 100644 dot_vim/ftplugin/latex-suite/packages/overcite create mode 100644 dot_vim/ftplugin/latex-suite/packages/parallel create mode 100644 dot_vim/ftplugin/latex-suite/packages/plain create mode 100644 dot_vim/ftplugin/latex-suite/packages/plates create mode 100644 dot_vim/ftplugin/latex-suite/packages/polski create mode 100644 dot_vim/ftplugin/latex-suite/packages/psgo create mode 100644 dot_vim/ftplugin/latex-suite/packages/schedule create mode 100644 dot_vim/ftplugin/latex-suite/packages/textfit create mode 100644 dot_vim/ftplugin/latex-suite/packages/times create mode 100644 dot_vim/ftplugin/latex-suite/packages/tipa create mode 100644 dot_vim/ftplugin/latex-suite/packages/ulem create mode 100644 dot_vim/ftplugin/latex-suite/packages/url create mode 100644 dot_vim/ftplugin/latex-suite/packages/verbatim create mode 100644 dot_vim/ftplugin/latex-suite/packages/version create mode 100644 dot_vim/ftplugin/latex-suite/projecttemplate.vim create mode 100644 dot_vim/ftplugin/latex-suite/pytools.py create mode 100644 dot_vim/ftplugin/latex-suite/smartspace.vim create mode 100644 dot_vim/ftplugin/latex-suite/templates.vim create mode 100644 dot_vim/ftplugin/latex-suite/templates/IEEEtran.tex create mode 100644 dot_vim/ftplugin/latex-suite/templates/article.tex create mode 100644 dot_vim/ftplugin/latex-suite/templates/report.tex create mode 100644 dot_vim/ftplugin/latex-suite/templates/report_two_column.tex create mode 100644 dot_vim/ftplugin/latex-suite/texmenuconf.vim create mode 100644 dot_vim/ftplugin/latex-suite/texproject.vim create mode 100644 dot_vim/ftplugin/latex-suite/texrc create mode 100644 dot_vim/ftplugin/latex-suite/texviewer.vim create mode 100644 dot_vim/ftplugin/latex-suite/version.vim create mode 100644 dot_vim/ftplugin/latex-suite/wizardfuncs.vim (limited to 'dot_vim/ftplugin/latex-suite') diff --git a/dot_vim/ftplugin/latex-suite/bibtex.vim b/dot_vim/ftplugin/latex-suite/bibtex.vim new file mode 100644 index 0000000..8037914 --- /dev/null +++ b/dot_vim/ftplugin/latex-suite/bibtex.vim @@ -0,0 +1,266 @@ +"============================================================================= +" File: bibtex.vim +" Function: BibT +" Author: Alan G Isaac +" modified by Srinath Avadhanula for latex-suite. +" License: Vim Charityware license. +" CVS: $Id: bibtex.vim 997 2006-03-20 09:45:45Z srinathava $ +"============================================================================= + +" Fields: +" Define what field type each letter denotes {{{ +" +let s:w_standsfor = 'address' +let s:a_standsfor = 'author' +let s:b_standsfor = 'booktitle' +let s:c_standsfor = 'chapter' +let s:d_standsfor = 'edition' +let s:e_standsfor = 'editor' +let s:h_standsfor = 'howpublished' +let s:i_standsfor = 'institution' +let s:k_standsfor = 'isbn' +let s:j_standsfor = 'journal' +let s:m_standsfor = 'month' +let s:n_standsfor = 'number' +let s:o_standsfor = 'organization' +let s:p_standsfor = 'pages' +let s:q_standsfor = 'publisher' +let s:r_standsfor = 'school' +let s:s_standsfor = 'series' +let s:t_standsfor = 'title' +let s:u_standsfor = 'type' +let s:v_standsfor = 'volume' +let s:y_standsfor = 'year' +let s:z_standsfor = 'note' + +" }}} +" Define the fields required for the various entry types {{{ +" +" s:{type}_required defines the required fields +" s:{type}_optional1 defines common optional fields +" s:{type}_optional2 defines uncommmon optional fields +" s:{type}_retval defines the first line of the formatted bib entry. +" +let s:key='<+key+>' + +let s:{'article'}_required="atjy" +let s:{'article'}_optional1="vnpm" +let s:{'article'}_optional2="z" " z is note +let s:{'article'}_retval = '@ARTICLE{' . s:key . ','."\n" + +let s:{'book'}_required="aetqy" " requires author *or* editor +let s:{'book'}_optional1="wd" +let s:{'book'}_optional2="vnsmz" " w is address, d is edition +let s:{'book'}_extras="k" " isbn +let s:{'book'}_retval = '@BOOK{' . s:key . ','."\n" + +let s:{'booklet'}_required="t" +let s:{'booklet'}_optional1="ahy" +let s:{'booklet'}_optional2="wmz" " w is address +let s:{'booklet'}_retval = '@BOOKLET{' . s:key . ','."\n" + +let s:{'inbook'}_required="aetcpqy" +let s:{'inbook'}_optional1="w" " w is address +let s:{'inbook'}_optional2="vnsudmz" " d is edition +let s:{'inbook'}_extras="k" " isbn +let s:{'inbook'}_retval = '@INBOOK{' . s:key . ','."\n" + +let s:{'incollection'}_required="atbqy" " b is booktitle +let s:{'incollection'}_optional1="cpw" " w is address, c is chapter +let s:{'incollection'}_optional2="evnsudmz" " d is edition +let s:{'incollection'}_extras="k" " isbn +let s:{'incollection'}_retval = '@INCOLLECTION{' . s:key . ','."\n" + +let s:{'inproceedings'}_required="atby" " b is booktitle +let s:{'inproceedings'}_optional1="epwoq" " w is address, q is publisher +let s:{'inproceedings'}_optional2="vnsmz" +let s:{'inproceedings'}_extras="k" " isbn +let s:{'inproceedings'}_retval = '@INPROCEEDINGS{' . s:key . ','."\n" + +let s:{'conference'}_required="atby" " b is booktitle +let s:{'conference'}_optional1="epwoq" " w is address, q is publisher +let s:{'conference'}_optional2="vnsmz" +let s:{'conference'}_extras="k" " isbn +let s:{'conference'}_retval = '@CONFERENCE{' . s:key . ','."\n" + +let s:{'manual'}_required="t" +let s:{'manual'}_optional1="ow" +let s:{'manual'}_optional2="admyz" " w is address +let s:{'manual'}_retval = '@MANUAL{' . s:key . ','."\n" + +let s:{'msthesis'}_required="atry" " r is school +let s:{'msthesis'}_optional1="w" " w is address +let s:{'msthesis'}_optional2="umz" " u is type, w is address +let s:{'msthesis'}_retval = '@MASTERSTHESIS{' . s:key . ','."\n" + +let s:{'misc'}_required="" +let s:{'misc'}_optional1="ath" +let s:{'misc'}_optional2="myz" +let s:{'misc'}_retval = '@MISC{' . s:key . ','."\n" + +let s:{'phdthesis'}_required="atry" " r is school +let s:{'phdthesis'}_optional1="w" " w is address +let s:{'phdthesis'}_optional2="umz" " u is type +let s:{'phdthesis'}_retval = '@PHDTHESIS{' . s:key . ','."\n" + +let s:{'proceedings'}_required="ty" +let s:{'proceedings'}_optional1="ewo" " w is address +let s:{'proceedings'}_optional2="vnsmqz" " q is publisher +let s:{'proceedings'}_retval = '@PROCEEDINGS{' . s:key . ','."\n" + +let s:{'techreport'}_required="atiy" +let s:{'techreport'}_optional1="unw" " u is type, w is address +let s:{'techreport'}_optional2="mz" +let s:{'techreport'}_retval = '@TECHREPORT{' . s:key . ','."\n" + +let s:{'unpublished'}_required="atz" +let s:{'unpublished'}_optional1="y" +let s:{'unpublished'}_optional2="m" +let s:{'unpublished'}_retval = '@UNPUBLISHED{' . s:key . ','."\n" + +" }}} + +if exists('s:done') + finish +endif +let s:done = 1 + +call IMAP ('BBB', "\=BibT('', '', 0)\", 'bib') +call IMAP ('BBL', "\=BibT('', 'o', 0)\", 'bib') +call IMAP ('BBH', "\=BibT('', 'O', 0)\", 'bib') +call IMAP ('BBX', "\=BibT('', 'Ox', 0)\", 'bib') + +" BibT: function to generate a formatted bibtex entry {{{ +" three sample usages: +" :call BibT() will request type choice +" :call BibT("article") preferred, provides most common fields +" :call BibT("article","ox") more optional fields (o) and extras (x) +" +" Input Arguments: +" type: is one of the types listed above. (this should be a complete name, not +" the acronym). +" options: a string containing 0 or more of the letters 'oOx' +" where +" o: include a bib entry with first set of options +" O: include a bib entry with extended options +" x: incude bib entry with extra options +" prompt: whether the fields are asked to be filled on the command prompt or +" whether place-holders are used. when prompt == 1, then comman line +" questions are used. +" +" Returns: +" a string containing a formatted bib entry +function BibT(type, options, prompt) + if a:type != '' + let choosetype = a:type + else + let types = + \ 'article'."\n". + \ 'booklet'."\n". + \ 'book'."\n". + \ 'conference'."\n". + \ 'inbook'."\n". + \ 'incollection'."\n". + \ 'inproceedings'."\n". + \ 'manual'."\n". + \ 'msthesis'."\n". + \ 'misc'."\n". + \ 'phdthesis'."\n". + \ 'proceedings'."\n". + \ 'techreport'."\n". + \ 'unpublished' + let choosetype = Tex_ChooseFromPrompt( + \ "Choose the type of bibliographic entry: \n" . + \ Tex_CreatePrompt(types, 3, "\n") . + \ "\nEnter number or filename :", + \ types, "\n") + if choosetype == '' + let choosetype = 'article' + endif + if types !~ '^\|\n'.choosetype.'$\|\n' + echomsg 'Please choose only one of the given types' + return + endif + endif + if a:options != '' + let options = a:options + else + let options = "" + endif + + let fields = '' + let extras="" + let retval = "" + + " define fields + let fields = s:{choosetype}_required + if options =~ 'o' && exists('s:'.choosetype.'_optional1') + let fields = fields . s:{choosetype}_optional1 + endif + if options =~ "O" && exists('s:'.choosetype.'_optional2') + if options !~ 'o'&& exists('s:'.choosetype.'_optional1') + let fields = fields . s:{choosetype}_optional1 + endif + let fields = fields . s:{choosetype}_optional2 + endif + if options =~ "x" && exists('s:'.choosetype.'_extras') + let fields = fields . extras + endif + if exists('g:Bib_'.choosetype.'_options') + let fields = fields . g:Bib_{choosetype}_options + endif + + let retval = s:{choosetype}_retval + + let i = 0 + while i < strlen(fields) + let field = strpart(fields, i, 1) + + if exists('s:'.field.'_standsfor') + let field_name = s:{field}_standsfor + let retval = retval.field_name." = {<++>},\n" + endif + + let i = i + 1 + endwhile + + " If the user wants even more fine-tuning... + if Tex_GetVarValue('Bib_'.choosetype.'_extrafields') != '' + + let extrafields = Tex_GetVarValue('Bib_'.choosetype.'_extrafields') + + let i = 1 + while 1 + let field_name = Tex_Strntok(extrafields, "\n", i) + if field_name == '' + break + endif + + let retval = retval.field_name." = {<++>},\n" + + let i = i + 1 + endwhile + + endif + + let retval = retval.'otherinfo = {<++>}'."\n" + let retval = retval."}<++>"."\n" + + return IMAP_PutTextWithMovement(retval) +endfunction + +" }}} +function! s:Input(prompt, ask) " {{{ + if a:ask == 1 + let retval = input(a:prompt) + if retval == '' + return "<++>" + endif + else + return "<++>" + endif +endfunction + +" }}} + +" vim:fdm=marker:ff=unix:noet:ts=4:sw=4 diff --git a/dot_vim/ftplugin/latex-suite/bibtools.py b/dot_vim/ftplugin/latex-suite/bibtools.py new file mode 100644 index 0000000..0a5366c --- /dev/null +++ b/dot_vim/ftplugin/latex-suite/bibtools.py @@ -0,0 +1,221 @@ +# Author: Srinath Avadhanula +# This file is distributed as part of the vim-latex project +# http://vim-latex.sf.net + +import re + +class Bibliography(dict): + def __init__(self, txt, macros={}): + """ + txt: + a string which represents the entire bibtex entry. A typical + entry is of the form: + @ARTICLE{ellington:84:part3, + author = {Ellington, C P}, + title = {The Aerodynamics of Hovering Insect Flight. III. Kinematics}, + journal = {Philosophical Transactions of the Royal Society of London. Series B, Biological Sciences}, + year = {1984}, + volume = {305}, + pages = {41-78}, + number = {1122}, + owner = {Srinath}, + pdf = {C:\srinath\research\papers\Ellington-3-Kinematics.pdf}, + timestamp = {2006.01.02}, + } + """ + + if macros: + for k, v in macros.iteritems(): + txt = txt.replace(k, '{'+v+'}') + + m = re.match(r'\s*@(\w+){((\S+),)?(.*)}\s*', txt, re.MULTILINE | re.DOTALL) + if not m: + return None + + self['bibtype'] = m.group(1).capitalize() + self['key'] = m.group(3) + self['body'] = m.group(4) + + body = self['body'] + self['bodytext'] = '' + while 1: + m = re.search(r'(\S+?)\s*=\s*(.)', body) + if not m: + break + + field = m.group(1) + + body = body[(m.start(2)+1):] + if m.group(2) == '{': + # search for the next closing brace. This is not simply a + # matter of searching for the next closing brace since + # braces can be nested. The following code basically goes + # to the next } which has not already been closed by a + # following {. + mniter = re.finditer(r'{|}', body) + + count = 1 + while 1: + try: + mn = mniter.next() + except StopIteration: + return None + + if mn.group(0) == '{': + count += 1 + else: + count -= 1 + + if count == 0: + value = body[:(mn.start(0))] + break + + elif m.group(2) == '"': + # search for the next unquoted double-quote. To be more + # precise, a double quote which is preceded by an even + # number of double quotes. + mn = re.search(r'(?!\\)(\\\\)*"', body) + if not mn: + return None + + value = body[:(mn.start(0))] + + else: + # $ always matches. So we do not need to do any + # error-checking. + mn = re.search(r',|$', body) + value = m.group(2) + body[:(mn.start(0))].rstrip() + + self[field] = re.sub(r'\s+', ' ', value) + body = body[(mn.start(0)+1):] + + self['bodytext'] += (' %s: %s\n' % (field, value)) + if self['bibtype'].lower() == 'string': + self['macro'] = {field: value} + + self['bodytext'] = self['bodytext'].rstrip() + + + def __getitem__(self, key): + try: + return dict.__getitem__(self, key) + except KeyError: + return '' + + def __str__(self): + if self['bibtype'].lower() == 'string': + return 'String: %(macro)s' % self + + elif self['bibtype'].lower() == 'article': + return ('Article [%(key)s]\n' + + 'TI "%(title)s"\n' + + 'AU %(author)s\n' + + 'IN In %(journal)s, %(year)s') % self + + elif self['bibtype'].lower() == 'conference': + return ('Conference [%(key)s]\n' + + 'TI "%(title)s"\n' + + 'AU %(author)s\n' + + 'IN In %(booktitle)s, %(year)s') % self + + elif self['bibtype'].lower() == 'mastersthesis': + return ('Masters [%(key)s]\n' + + 'TI "%(title)s"\n' + + 'AU %(author)s\n' + + 'IN In %(school)s, %(year)s') % self + + elif self['bibtype'].lower() == 'phdthesis': + return ('PhD [%(key)s]\n' + + 'TI "%(title)s"\n' + + 'AU %(author)s\n' + + 'IN In %(school)s, %(year)s') % self + + elif self['bibtype'].lower() == 'book': + return ('Book [%(key)s]\n' + + 'TI "%(title)s"\n' + + 'AU %(author)s\n' + + 'IN %(publisher)s, %(year)s') % self + + else: + s = '%(bibtype)s [%(key)s]\n' % self + if self['title']: + s += 'TI "%(title)s"\n' % self + if self['author']: + s += 'AU %(author)s\n' % self + for k, v in self.iteritems(): + if k not in ['title', 'author', 'bibtype', 'key', 'id', 'file', 'body', 'bodytext']: + s += 'MI %s: %s\n' % (k, v) + + return s.rstrip() + + def satisfies(self, filters): + for field, regexp in filters: + if not re.search(regexp, self[field], re.I): + return False + + return True + +class BibFile: + + def __init__(self, filelist=''): + self.bibentries = [] + self.filters = [] + self.macros = {} + self.sortfields = [] + if filelist: + for f in filelist.splitlines(): + self.addfile(f) + + def addfile(self, file): + fields = open(file).read().split('@') + for f in fields: + if not (f and re.match('string', f, re.I)): + continue + + b = Bibliography('@' + f) + self.macros.update(b['macro']) + + for f in fields: + if not f or re.match('string', f, re.I): + continue + + b = Bibliography('@' + f, self.macros) + if b: + b['file'] = file + b['id'] = len(self.bibentries) + self.bibentries += [b] + + + def addfilter(self, filterspec): + self.filters += [filterspec.split()] + + def rmfilters(self): + self.filters = [] + + def __str__(self): + s = '' + for b in self.bibentries: + if b['key'] and b.satisfies(self.filters): + s += '%s\n\n' % b + return s + + def addsortfield(self, field): + self.sortfields += [field] + + def rmsortfields(self): + self.sortfields = [] + + def sort(self): + def cmpfun(b1, b2): + for f in self.sortfields: + c = cmp(b1[f], b2[f]) + if c: + return c + return 0 + self.bibentries.sort(cmp=cmpfun) + +if __name__ == "__main__": + import sys + + bf = BibFile(sys.argv[1]) + print bf diff --git a/dot_vim/ftplugin/latex-suite/bibtools.pyc b/dot_vim/ftplugin/latex-suite/bibtools.pyc new file mode 100644 index 0000000..c79961f Binary files /dev/null and b/dot_vim/ftplugin/latex-suite/bibtools.pyc differ diff --git a/dot_vim/ftplugin/latex-suite/brackets.vim b/dot_vim/ftplugin/latex-suite/brackets.vim new file mode 100644 index 0000000..0669ce4 --- /dev/null +++ b/dot_vim/ftplugin/latex-suite/brackets.vim @@ -0,0 +1,145 @@ +" ============================================================================== +" History: This was originally part of auctex.vim by Carl Mueller. +" Srinath Avadhanula incorporated it into latex-suite with +" significant modifications. +" Parts of this file may be copyrighted by others as noted. +" CVS: $Id: brackets.vim 997 2006-03-20 09:45:45Z srinathava $ +" Description: +" This ftplugin provides the following maps: +" . encloses the previous character in \mathbf{} +" . is polymorphic as follows: +" Insert mode: +" 1. If the previous character is a letter or number, then capitalize it and +" enclose it in \mathcal{} +" 2. otherwise insert \cite{} +" Visual Mode: +" 1. Enclose selection in \mathcal{} +" . is also polymorphic as follows: +" If the character before typing is one of '([{| \left(\right +" similarly for [, | +" { \left\{\right\} +" 2. < \langle\rangle +" 3. q \lefteqn{} +" otherwise insert \label{} +" . inserts \item commands at the current cursor location depending on +" the surrounding environment. For example, inside itemize, it will +" insert a simple \item, but within a description, it will insert +" \item[<+label+>] etc. +" +" These functions make it extremeley easy to do all the \left \right stuff in +" latex. +" ============================================================================== + +" Avoid reinclusion. +if exists('b:did_brackets') + finish +endif +let b:did_brackets = 1 + +" define the funtions only once. +if exists('*Tex_MathBF') + finish +endif + +" Tex_MathBF: encloses te previous letter/number in \mathbf{} {{{ +" Description: +function! Tex_MathBF() + return "\\\mathbf{\}" +endfunction " }}} +" Tex_MathCal: enclose the previous letter/number in \mathcal {{{ +" Description: +" if the last character is not a letter/number, then insert \cite{} +function! Tex_MathCal() + let line = getline(line(".")) + let char = line[col(".")-2] + + if char =~ '[a-zA-Z0-9]' + return "\".'\mathcal{'.toupper(char).'}' + else + return IMAP_PutTextWithMovement('\cite{<++>}<++>') + endif +endfunction +" }}} +" Tex_LeftRight: maps in insert mode. {{{ +" Description: +" This is a polymorphic function, which maps the behaviour of in the +" following way: +" If the character before typing is one of '([{| \left(<++>\right<++> +" similarly for [, | +" { \left\{<++>\right\}<++> +" 2. < \langle<++>\rangle<++> +" 3. q \lefteqn{<++>}<++> +" otherwise insert \label{<++>}<++> +function! Tex_LeftRight() + let line = getline(line(".")) + let char = line[col(".")-2] + let previous = line[col(".")-3] + + let matchedbrackets = '()[]{}||' + if char =~ '(\|\[\|{\||' + let add = '' + if char =~ '{' + let add = "\\" + endif + let rhs = matchstr(matchedbrackets, char.'\zs.\ze') + return "\".IMAP_PutTextWithMovement('\left'.add.char.'<++>\right'.add.rhs.'<++>') + elseif char == '<' + return "\".IMAP_PutTextWithMovement('langle<++>\rangle<++>') + elseif char == 'q' + return "\".IMAP_PutTextWithMovement('\lefteqn{<++>}<++>') + else + return IMAP_PutTextWithMovement('\label{<++>}<++>') + endif +endfunction " }}} +" Tex_PutLeftRight: maps in normal mode {{{ +" Description: +" Put \left...\right in front of the matched brackets. +function! Tex_PutLeftRight() + let previous = getline(line("."))[col(".") - 2] + let char = getline(line("."))[col(".") - 1] + if previous == '\' + if char == '{' + exe "normal ileft\\\l%iright\\\l%" + elseif char == '}' + exe "normal iright\\\l%ileft\\\l%" + endif + elseif char =~ '\[\|(' + exe "normal i\\left\l%i\\right\l%" + elseif char =~ '\]\|)' + exe "normal i\\right\l%i\\left\l%" + endif +endfunction " }}} + +" Provide 'd mapping for easy user customization. {{{ +inoremap Tex_MathBF =Tex_MathBF() +inoremap Tex_MathCal =Tex_MathCal() +inoremap Tex_LeftRight =Tex_LeftRight() +vnoremap Tex_MathBF `>a}` +vnoremap Tex_MathCal `>a}` +nnoremap Tex_LeftRight :call Tex_PutLeftRight() + +" }}} +" Tex_SetBracketingMaps: create mappings for the current buffer {{{ +function! Tex_SetBracketingMaps() + + call Tex_MakeMap('', 'Tex_MathBF', 'i', ' ') + call Tex_MakeMap('', 'Tex_MathCal', 'i', ' ') + call Tex_MakeMap('', 'Tex_LeftRight', 'i', ' ') + call Tex_MakeMap('', 'Tex_MathBF', 'v', ' ') + call Tex_MakeMap('', 'Tex_MathCal', 'v', ' ') + call Tex_MakeMap('', 'Tex_LeftRight', 'n', ' ') + +endfunction +" }}} + +augroup LatexSuite + au LatexSuite User LatexSuiteFileType + \ call Tex_Debug('brackets.vim: Catching LatexSuiteFileType event', 'brak') | + \ call Tex_SetBracketingMaps() +augroup END + +" vim:fdm=marker diff --git a/dot_vim/ftplugin/latex-suite/compiler.vim b/dot_vim/ftplugin/latex-suite/compiler.vim new file mode 100644 index 0000000..245f6cd --- /dev/null +++ b/dot_vim/ftplugin/latex-suite/compiler.vim @@ -0,0 +1,820 @@ +"============================================================================= +" File: compiler.vim +" Author: Srinath Avadhanula +" Created: Tue Apr 23 05:00 PM 2002 PST +" +" Description: functions for compiling/viewing/searching latex documents +" CVS: $Id: compiler.vim 997 2006-03-20 09:45:45Z srinathava $ +"============================================================================= + +" Tex_SetTeXCompilerTarget: sets the 'target' for the next call to Tex_RunLaTeX() {{{ +function! Tex_SetTeXCompilerTarget(type, target) + call Tex_Debug("+Tex_SetTeXCompilerTarget: setting target to [".a:target."] for ".a:type."r", "comp") + + if a:target == '' + let target = Tex_GetVarValue('Tex_DefaultTargetFormat') + let target = input('Enter the target format for '.a:type.'r: ', target) + else + let target = a:target + endif + if target == '' + let target = 'dvi' + endif + + let targetRule = Tex_GetVarValue('Tex_'.a:type.'Rule_'.target) + + if targetRule != '' + if a:type == 'Compile' + let &l:makeprg = escape(targetRule, Tex_GetVarValue('Tex_EscapeChars')) + elseif a:type == 'View' + let s:viewer = targetRule + endif + let s:target = target + + elseif Tex_GetVarValue('Tex_'.a:type.'RuleComplete_'.target) != '' + let s:target = target + + else + let curd = getcwd() + exe 'cd '.expand('%:p:h') + if !Tex_GetVarValue('Tex_UseMakefile') || (glob('makefile*') == '' && glob('Makefile*') == '') + if has('gui_running') + call confirm( + \'No '.a:type.' rule defined for target '.target."\n". + \'Please specify a rule in $VIMRUNTIME/ftplugin/tex/texrc'."\n". + \' :help Tex_'.a:type.'Rule_format'."\n". + \'for more information', + \"&ok", 1, 'Warning') + else + call input( + \'No '.a:type.' rule defined for target '.target."\n". + \'Please specify a rule in $VIMRUNTIME/ftplugin/tex/texrc'."\n". + \' :help Tex_'.a:type.'Rule_format'."\n". + \'for more information' + \) + endif + else + echomsg 'Assuming target is for makefile' + let s:target = target + endif + exe 'cd '.curd + endif +endfunction + +function! SetTeXTarget(...) + if a:0 < 1 + let target = Tex_GetVarValue('Tex_DefaultTargetFormat') + let target = input('Enter the target format for compiler and viewer: ', target) + else + let target = a:1 + endif + if target == '' + let target = 'dvi' + endif + + call Tex_SetTeXCompilerTarget('Compile', target) + call Tex_SetTeXCompilerTarget('View', target) +endfunction + +com! -nargs=1 TCTarget :call Tex_SetTeXCompilerTarget('Compile', ) +com! -nargs=1 TVTarget :call Tex_SetTeXCompilerTarget('View', ) +com! -nargs=? TTarget :call SetTeXTarget() + +" }}} +" Tex_CompileLatex: compiles the present file. {{{ +" Description: +function! Tex_CompileLatex() + if &ft != 'tex' + echo "calling Tex_RunLaTeX from a non-tex file" + return + end + + " close any preview windows left open. + pclose! + + let curd = getcwd() + + " Find the main file corresponding to this file. Always cd to the + " directory containing the file to avoid problems with the directory + " containing spaces. + " Latex on linux seems to be unable to handle file names with spaces at + " all! Therefore for the moment, do not attempt to handle spaces in the + " file name. + if exists('b:fragmentFile') + let mainfname = expand('%:p:t') + call Tex_CD(expand('%:p:h')) + else + let mainfname = Tex_GetMainFileName(':p:t') + call Tex_CD(Tex_GetMainFileName(':p:h')) + end + + call Tex_Debug('Tex_CompileLatex: getting mainfname = ['.mainfname.'] from Tex_GetMainFileName', 'comp') + + " if a makefile exists and the user wants to use it, then use that + " irrespective of whether *.latexmain exists or not. mainfname is still + " extracted from *.latexmain (if possible) log file name depends on the + " main file which will be compiled. + if Tex_GetVarValue('Tex_UseMakefile') && (glob('makefile') != '' || glob('Makefile') != '') + let _makeprg = &l:makeprg + call Tex_Debug("Tex_CompileLatex: using the makefile in the current directory", "comp") + let &l:makeprg = 'make $*' + if exists('s:target') + call Tex_Debug('Tex_CompileLatex: execing [make! '.s:target.']', 'comp') + exec 'make! '.s:target + else + call Tex_Debug('Tex_CompileLatex: execing [make!]', 'comp') + exec 'make!' + endif + let &l:makeprg = _makeprg + else + " If &makeprg has something like "$*.ps", it means that it wants the + " file-name without the extension... Therefore remove it. + if &makeprg =~ '\$\*\.\w\+' + let mainfname = fnamemodify(mainfname, ':r') + endif + call Tex_Debug('Tex_CompileLatex: execing [make! '.mainfname.']', 'comp') + exec 'make! '.mainfname + endif + redraw! + + call Tex_CD(curd) +endfunction " }}} +" Tex_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 +" Tex_RunLaTeX() is called. +function! Tex_RunLaTeX() + call Tex_Debug('+Tex_RunLaTeX, b:fragmentFile = '.exists('b:fragmentFile'), 'comp') + + let dir = expand("%:p:h").'/' + let curd = getcwd() + call Tex_CD(expand("%:p:h")) + + let initTarget = s:target + + " first get the dependency chain of this format. + call Tex_Debug("Tex_RunLaTeX: compiling to target [".s:target."]", "comp") + + if Tex_GetVarValue('Tex_FormatDependency_'.s:target) != '' + let dependency = Tex_GetVarValue('Tex_FormatDependency_'.s:target) + if dependency !~ ','.s:target.'$' + let dependency = dependency.','.s:target + endif + else + let dependency = s:target + endif + + call Tex_Debug('Tex_RunLaTeX: getting dependency chain = ['.dependency.']', 'comp') + + " now compile to the final target format via each dependency. + let i = 1 + while Tex_Strntok(dependency, ',', i) != '' + let s:target = Tex_Strntok(dependency, ',', i) + + call Tex_SetTeXCompilerTarget('Compile', s:target) + call Tex_Debug('Tex_RunLaTeX: setting target to '.s:target, 'comp') + + if Tex_GetVarValue('Tex_MultipleCompileFormats') =~ '\<'.s:target.'\>' + call Tex_Debug("Tex_RunLaTeX: compiling file multiple times via Tex_CompileMultipleTimes", "comp") + call Tex_CompileMultipleTimes() + else + call Tex_Debug("Tex_RunLaTeX: compiling file once via Tex_CompileLatex", "comp") + call Tex_CompileLatex() + endif + + let errlist = Tex_GetErrorList() + call Tex_Debug("Tex_RunLaTeX: errlist = [".errlist."]", "comp") + + " If there are any errors, then break from the rest of the steps + if errlist =~ '\v(error|warning)' + call Tex_Debug('Tex_RunLaTeX: There were errors in compiling, breaking chain...', 'comp') + break + endif + + let i = i + 1 + endwhile + + let s:target = initTarget + let s:origwinnum = winnr() + call Tex_SetupErrorWindow() + + call Tex_CD(curd) + call Tex_Debug("-Tex_RunLaTeX", "comp") +endfunction + +" }}} +" Tex_ViewLaTeX: opens viewer {{{ +" Description: opens the DVI viewer for the file being currently edited. +" Again, if the current file is a \input in a master file, see text above +" Tex_RunLaTeX() to see how to set this information. +function! Tex_ViewLaTeX() + if &ft != 'tex' + echo "calling Tex_ViewLaTeX from a non-tex file" + return + end + + let curd = getcwd() + + " If b:fragmentFile is set, it means this file was compiled as a fragment + " using Tex_PartCompile, which means that we want to ignore any + " *.latexmain or makefile's. + if !exists('b:fragmentFile') + " cd to the location of the file to avoid having to deal with spaces + " in the directory name. + let mainfname = Tex_GetMainFileName(':p:t:r') + call Tex_CD(Tex_GetMainFileName(':p:h')) + else + let mainfname = expand("%:p:t:r") + call Tex_CD(expand("%:p:h")) + endif + + if Tex_GetVarValue('Tex_ViewRuleComplete_'.s:target) != '' + + let execString = Tex_GetVarValue('Tex_ViewRuleComplete_'.s:target) + let execString = substitute(execString, '{v:servername}', v:servername, 'g') + + elseif has('win32') + " unfortunately, yap does not allow the specification of an external + " editor from the command line. that would have really helped ensure + " that this particular vim and yap are connected. + let execString = 'start '.s:viewer.' "$*.'.s:target.'"' + + elseif has('macunix') + if strlen(s:viewer) + let s:viewer = '-a '.s:viewer + endif + let execString = 'open '.s:viewer.' $*.'.s:target + + else + " taken from Dimitri Antoniou's tip on vim.sf.net (tip #225). + " slight change to actually use the current servername instead of + " hardcoding it as xdvi. + " Using an option for specifying the editor in the command line + " because that seems to not work on older bash'es. + if s:target == 'dvi' + + if Tex_GetVarValue('Tex_UseEditorSettingInDVIViewer') == 1 && + \ v:servername != '' && + \ (s:viewer == "xdvi" || s:viewer == "xdvik") + + let execString = s:viewer.' -editor "gvim --servername '.v:servername. + \ ' --remote-silent +\%l \%f" $*.dvi &' + + elseif Tex_GetVarValue('Tex_UseEditorSettingInDVIViewer') == 1 && + \ s:viewer == "kdvi" + + let execString = 'kdvi --unique $*.dvi &' + + else + + let execString = s:viewer.' $*.dvi &' + + endif + + else + + let execString = s:viewer.' $*.'.s:target.' &' + + endif + end + + let execString = substitute(execString, '\V$*', mainfname, 'g') + call Tex_Debug("Tex_ViewLaTeX: execString = ".execString, "comp") + + exec 'silent! !'.execString + + if !has('gui_running') + redraw! + endif + + call Tex_CD(curd) +endfunction + +" }}} +" Tex_ForwardSearchLaTeX: searches for current location in dvi file. {{{ +" Description: if the DVI viewr is compatible, then take the viewer to that +" position in the dvi file. see docs for Tex_RunLaTeX() to set a +" master file if this is an \input'ed file. +" Tip: With YAP on Windows, it is possible to do forward and inverse searches +" on DVI files. to do forward search, you'll have to compile the file +" with the --src-specials option. then set the following as the command +" line in the 'view/options/inverse search' dialog box: +" gvim --servername LATEX --remote-silent +%l "%f" +" For inverse search, if you are reading this, then just pressing \ls +" will work. +function! Tex_ForwardSearchLaTeX() + if &ft != 'tex' + echo "calling Tex_ViewLaTeX from a non-tex file" + return + end + + " only know how to do forward search for yap on windows and xdvik (and + " some newer versions of xdvi) on unices. Therefore forward searching will + " automatically open the DVI viewer irrespective of what the user chose as + " the default view format. + if Tex_GetVarValue('Tex_ViewRule_dvi') == '' + return + endif + let viewer = Tex_GetVarValue('Tex_ViewRule_dvi') + + let curd = getcwd() + + let mainfname = Tex_GetMainFileName(':t') + let mainfnameRoot = fnamemodify(Tex_GetMainFileName(), ':t:r') + " cd to the location of the file to avoid problems with directory name + " containing spaces. + call Tex_CD(Tex_GetMainFileName(':p:h')) + + " inverse search tips taken from Dimitri Antoniou's tip and Benji Fisher's + " tips on vim.sf.net (vim.sf.net tip #225) + if has('win32') + + let execString = 'silent! !start '. viewer.' -s '.line('.').expand('%').' '.mainfnameRoot + + else + if Tex_GetVarValue('Tex_UseEditorSettingInDVIViewer') == 1 && + \ exists('v:servername') && + \ (viewer == "xdvi" || viewer == "xdvik") + + let execString = 'silent! !'.viewer.' -name xdvi -sourceposition '.line('.').expand("%"). + \ ' -editor "gvim --servername '.v:servername.' --remote-silent +\%l \%f" '. + \ mainfnameRoot.'.dvi &' + + elseif Tex_GetVarValue('Tex_UseEditorSettingInDVIViewer') == 1 && viewer == "kdvi" + + let execString = 'silent! !kdvi --unique file:'.mainfnameRoot.'.dvi\#src:'.line('.').expand("%").' &' + + else + + let execString = 'silent! !'.viewer.' -name xdvi -sourceposition '.line('.').expand("%").' '.mainfnameRoot.'.dvi &' + + endif + end + + call Tex_Debug("Tex_ForwardSearchLaTeX: execString = ".execString, "comp") + execute execString + if !has('gui_running') + redraw! + endif + + call Tex_CD(curd) +endfunction + +" }}} + +" ============================================================================== +" Functions for compiling parts of a file. +" ============================================================================== +" Tex_PartCompile: compiles selected fragment {{{ +" Description: creates a temporary file from the selected fragment of text +" prepending the preamble and \end{document} and then asks Tex_RunLaTeX() to +" compile it. +function! Tex_PartCompile() range + call Tex_Debug('+Tex_PartCompile', 'comp') + " Save position + let pos = line('.').' | normal! '.virtcol('.').'|' + + " Get a temporary file in the same directory as the file from which + " fragment is being extracted. This is to enable the use of relative path + " names in the fragment. + let tmpfile = Tex_GetTempName(expand('%:p:h')) + + " Remember all the temp files and for each temp file created, remember + " where the temp file came from. + let s:Tex_NumTempFiles = (exists('s:Tex_NumTempFiles') ? s:Tex_NumTempFiles + 1 : 1) + let s:Tex_TempFiles = (exists('s:Tex_TempFiles') ? s:Tex_TempFiles : '') + \ . tmpfile."\n" + let s:Tex_TempFile_{s:Tex_NumTempFiles} = tmpfile + " TODO: For a function Tex_RestoreFragment which restores a temp file to + " its original location. + let s:Tex_TempFileOrig_{s:Tex_NumTempFiles} = expand('%:p') + let s:Tex_TempFileRange_{s:Tex_NumTempFiles} = a:firstline.','.a:lastline + + " Set up an autocmd to clean up the temp files when Vim exits. + if Tex_GetVarValue('Tex_RemoveTempFiles') + augroup RemoveTmpFiles + au! + au VimLeave * :call Tex_RemoveTempFiles() + augroup END + endif + + " If mainfile exists open it in tiny window and extract preamble there, + " otherwise do it from current file + let mainfile = Tex_GetMainFileName(":p") + exe 'bot 1 split '.escape(mainfile, ' ') + exe '1,/\s*\\begin{document}/w '.tmpfile + wincmd q + + exe a:firstline.','.a:lastline."w! >> ".tmpfile + + " edit the temporary file + exec 'drop '.tmpfile + + " append the \end{document} line. + $ put ='\end{document}' + w + + " set this as a fragment file. + let b:fragmentFile = 1 + + silent! call Tex_RunLaTeX() +endfunction " }}} +" Tex_RemoveTempFiles: cleans up temporary files created during part compilation {{{ +" Description: During part compilation, temporary files containing the +" visually selected text are created. These files need to be +" removed when Vim exits to avoid "file leakage". +function! Tex_RemoveTempFiles() + if !exists('s:Tex_NumTempFiles') || !Tex_GetVarValue('Tex_RemoveTempFiles') + return + endif + let i = 1 + while i <= s:Tex_NumTempFiles + let tmpfile = s:Tex_TempFile_{i} + " Remove the tmp file and all other associated files such as the + " .log files etc. + call Tex_DeleteFile(fnamemodify(tmpfile, ':p:r').'.*') + let i = i + 1 + endwhile +endfunction " }}} + +" ============================================================================== +" Compiling a file multiple times to resolve references/citations etc. +" ============================================================================== +" Tex_CompileMultipleTimes: The main function {{{ +" Description: compiles a file multiple times to get cross-references right. +function! Tex_CompileMultipleTimes() + " Just extract the root without any extension because we want to construct + " the log file names etc from it. + let curd = getcwd() + let mainFileName_root = Tex_GetMainFileName(':p:t:r') + call Tex_CD(Tex_GetMainFileName(':p:h')) + + " First ignore undefined references and the + " "rerun to get cross-references right" message from + " the compiler output. + let origlevel = Tex_GetVarValue('Tex_IgnoreLevel') + let origpats = Tex_GetVarValue('Tex_IgnoredWarnings') + + let g:Tex_IgnoredWarnings = g:Tex_IgnoredWarnings."\n" + \ . 'Reference %.%# undefined'."\n" + \ . 'Rerun to get cross-references right' + TCLevel 1000 + + let idxFileName = mainFileName_root.'.idx' + let auxFileName = mainFileName_root.'.aux' + + let runCount = 0 + let needToRerun = 1 + while needToRerun == 1 && runCount < 5 + " assume we need to run only once. + let needToRerun = 0 + + let idxlinesBefore = Tex_CatFile(idxFileName) + let auxlinesBefore = Tex_GetAuxFile(auxFileName) + + " first run latex. + echomsg "latex run number : ".(runCount+1) + call Tex_Debug("Tex_CompileMultipleTimes: latex run number : ".(runCount+1), "comp") + silent! call Tex_CompileLatex() + + " If there are errors in any latex compilation step, immediately + " return. For now, do not bother with warnings because those might go + " away after compiling again or after bibtex is run etc. + let errlist = Tex_GetErrorList() + call Tex_Debug("Tex_CompileMultipleTimes: errors = [".errlist."]", "comp") + + if errlist =~ 'error' + let g:Tex_IgnoredWarnings = origpats + exec 'TCLevel '.origlevel + + return + endif + + let idxlinesAfter = Tex_CatFile(idxFileName) + + " If .idx file changed, then run makeindex to generate the new .ind + " file and remember to rerun latex. + if runCount == 0 && glob(idxFileName) != '' && idxlinesBefore != idxlinesAfter + echomsg "Running makeindex..." + let temp_mp = &mp | let &mp = Tex_GetVarValue('Tex_MakeIndexFlavor') + exec 'silent! make '.mainFileName_root + let &mp = temp_mp + + let needToRerun = 1 + endif + + " The first time we see if we need to run bibtex and if the .bbl file + " changes, we will rerun latex. + if runCount == 0 && Tex_IsPresentInFile('\\bibdata', mainFileName_root.'.aux') + let bibFileName = mainFileName_root.'.bbl' + + let biblinesBefore = Tex_CatFile(bibFileName) + + echomsg "Running '".Tex_GetVarValue('Tex_BibtexFlavor')."' ..." + let temp_mp = &mp | let &mp = Tex_GetVarValue('Tex_BibtexFlavor') + exec 'silent! make '.mainFileName_root + let &mp = temp_mp + + let biblinesAfter = Tex_CatFile(bibFileName) + + " If the .bbl file changed after running bibtex, we need to + " latex again. + if biblinesAfter != biblinesBefore + echomsg 'Need to rerun because bibliography file changed...' + call Tex_Debug('Tex_CompileMultipleTimes: Need to rerun because bibliography file changed...', 'comp') + let needToRerun = 1 + endif + endif + + " check if latex asks us to rerun + let auxlinesAfter = Tex_GetAuxFile(auxFileName) + if auxlinesAfter != auxlinesBefore + echomsg "Need to rerun because the AUX file changed..." + call Tex_Debug("Tex_CompileMultipleTimes: Need to rerun to get cross-references right...", 'comp') + let needToRerun = 1 + endif + + let runCount = runCount + 1 + endwhile + + call Tex_Debug("Tex_CompileMultipleTimes: Ran latex ".runCount." time(s)", "comp") + echomsg "Ran latex ".runCount." time(s)" + + let g:Tex_IgnoredWarnings = origpats + exec 'TCLevel '.origlevel + " After all compiler calls are done, reparse the .log file for + " errors/warnings to handle the situation where the clist might have been + " emptied because of bibtex/makeindex being run as the last step. + exec 'silent! cfile '.mainFileName_root.'.log' + + call Tex_CD(curd) +endfunction " }}} +" Tex_GetAuxFile: get the contents of the AUX file {{{ +" Description: get the contents of the AUX file recursively including any +" @\input'ted AUX files. +function! Tex_GetAuxFile(auxFile) + if !filereadable(a:auxFile) + return '' + endif + + let auxContents = Tex_CatFile(a:auxFile) + let pattern = '@\input{\(.\{-}\)}' + + let auxContents = substitute(auxContents, pattern, '\=Tex_GetAuxFile(submatch(1))', 'g') + + return auxContents +endfunction " }}} + +" ============================================================================== +" Helper functions for +" . viewing the log file in preview mode. +" . syncing the display between the quickfix window and preview window +" . going to the correct line _and column_ number from from the quick fix +" window. +" ============================================================================== +" Tex_SetupErrorWindow: sets up the cwindow and preview of the .log file {{{ +" Description: +function! Tex_SetupErrorWindow() + let mainfname = Tex_GetMainFileName() + + let winnum = winnr() + + " close the quickfix window before trying to open it again, otherwise + " whether or not we end up in the quickfix window after the :cwindow + " command is not fixed. + cclose + cwindow + " create log file name from mainfname + let mfnlog = fnamemodify(mainfname, ":t:r").'.log' + call Tex_Debug('Tex_SetupErrorWindow: mfnlog = '.mfnlog, 'comp') + " if we moved to a different window, then it means we had some errors. + if winnum != winnr() + if Tex_GetVarValue('Tex_ShowErrorContext') + call Tex_UpdatePreviewWindow(mfnlog) + exe 'nnoremap j j:call Tex_UpdatePreviewWindow("'.mfnlog.'")' + exe 'nnoremap k k:call Tex_UpdatePreviewWindow("'.mfnlog.'")' + exe 'nnoremap :call Tex_UpdatePreviewWindow("'.mfnlog.'")' + exe 'nnoremap :call Tex_UpdatePreviewWindow("'.mfnlog.'")' + endif + exe 'nnoremap :call Tex_GotoErrorLocation("'.mfnlog.'")' + + setlocal nowrap + + " resize the window to just fit in with the number of lines. + exec ( line('$') < 4 ? line('$') : 4 ).' wincmd _' + if Tex_GetVarValue('Tex_GotoError') == 1 + call Tex_GotoErrorLocation(mfnlog) + else + exec s:origwinnum.' wincmd w' + endif + endif + +endfunction " }}} +" Tex_PositionPreviewWindow: positions the preview window correctly. {{{ +" Description: +" The purpose of this function is to count the number of times an error +" occurs on the same line. or in other words, if the current line is +" something like |10 error|, then we want to count the number of +" lines in the quickfix window before this line which also contain lines +" like |10 error|. +" +function! Tex_PositionPreviewWindow(filename) + + if getline('.') !~ '|\d\+ \(error\|warning\)|' + if !search('|\d\+ \(error\|warning\)|') + call Tex_Debug("not finding error pattern anywhere in quickfix window :".bufname(bufnr('%')), + \ 'comp') + pclose! + return + endif + endif + + " extract the error pattern (something like 'file.tex|10 error|') on the + " current line. + let errpat = matchstr(getline('.'), '^\f*|\d\+ \(error\|warning\)|\ze') + let errfile = matchstr(getline('.'), '^\f*\ze|\d\+ \(error\|warning\)|') + " extract the line number from the error pattern. + let linenum = matchstr(getline('.'), '|\zs\d\+\ze \(error\|warning\)|') + + " if we are on an error, then count the number of lines before this in the + " quickfix window with an error on the same line. + if errpat =~ 'error|$' + " our location in the quick fix window. + let errline = line('.') + + " goto the beginning of the quickfix window and begin counting the lines + " which show an error on the same line. + 0 + let numrep = 0 + while 1 + " if we are on the same kind of error line, then means we have another + " line containing the same error pattern. + if getline('.') =~ errpat + let numrep = numrep + 1 + normal! 0 + endif + " if we have reached the original location in the quick fix window, + " then break. + if line('.') == errline + break + else + " otherwise, search for the next line which contains the same + " error pattern again. goto the end of the current line so we + " dont count this line again. + normal! $ + call search(errpat, 'W') + endif + endwhile + else + let numrep = 1 + endif + + if getline('.') =~ '|\d\+ warning|' + let searchpat = escape(matchstr(getline('.'), '|\d\+ warning|\s*\zs.*'), '\ ') + else + let searchpat = 'l\.'.linenum + endif + + " We first need to be in the scope of the correct file in the .log file. + " This is important for example, when a.tex and b.tex both have errors on + " line 9 of the file and we want to go to the error of b.tex. Merely + " searching forward from the beginning of the log file for l.9 will always + " land us on the error in a.tex. + if errfile != '' + exec 'silent! bot pedit +/(\\(\\f\\|\\[\\|\]\\|\\s\\)*'.errfile.'/ '.a:filename + else + exec 'bot pedit +0 '.a:filename + endif + " Goto the preview window + " TODO: This is not robust enough. Check that a wincmd j actually takes + " us to the preview window. + wincmd j + " now search forward from this position in the preview window for the + " numrep^th error of the current line in the quickfix window. + while numrep > 0 + call search(searchpat, 'W') + let numrep = numrep - 1 + endwhile + normal! z. + +endfunction " }}} +" Tex_UpdatePreviewWindow: updates the view of the log file {{{ +" Description: +" This function should be called when focus is in a quickfix window. +" It opens the log file in a preview window and makes it display that +" part of the log file which corresponds to the error which the user is +" currently on in the quickfix window. Control returns to the quickfix +" window when the function returns. +" +function! Tex_UpdatePreviewWindow(filename) + call Tex_PositionPreviewWindow(a:filename) + + if &previewwindow + 6 wincmd _ + wincmd p + endif +endfunction " }}} +" Tex_GotoErrorLocation: goes to the correct location of error in the tex file {{{ +" Description: +" This function should be called when focus is in a quickfix window. This +" function will first open the preview window of the log file (if it is not +" already open), position the display of the preview to coincide with the +" current error under the cursor and then take the user to the file in +" which this error has occured. +" +" The position is both the correct line number and the column number. +function! Tex_GotoErrorLocation(filename) + + " first use vim's functionality to take us to the location of the error + " accurate to the line (not column). This lets us go to the correct file + " without applying any logic. + exec "normal! \" + " If the log file is not found, then going to the correct line number is + " all we can do. + if glob(a:filename) == '' + return + endif + + let winnum = winnr() + " then come back to the quickfix window + wincmd w + + " find out where in the file we had the error. + let linenum = matchstr(getline('.'), '|\zs\d\+\ze \(warning\|error\)|') + call Tex_PositionPreviewWindow(a:filename) + + if getline('.') =~ 'l.\d\+' + + let brokenline = matchstr(getline('.'), 'l.'.linenum.' \zs.*\ze') + " If the line is of the form + " l.10 ...and then there was some error + " it means (most probably) that only part of the erroneous line is + " shown. In this case, finding the length of the broken line is not + " correct. Instead goto the beginning of the line and search forward + " for the part which is displayed and then go to its end. + if brokenline =~ '^\M...' + let partline = matchstr(brokenline, '^\M...\m\zs.*') + let normcmd = "0/\\V".escape(partline, "\\")."/e+1\" + else + let column = strlen(brokenline) + 1 + let normcmd = column.'|' + endif + + elseif getline('.') =~ 'LaTeX Warning: \(Citation\|Reference\) `.*' + + let ref = matchstr(getline('.'), "LaTeX Warning: \\(Citation\\|Reference\\) `\\zs[^']\\+\\ze'") + let normcmd = '0/'.ref."\" + + else + + let normcmd = '0' + + endif + + " go back to the window where we came from. + exec winnum.' wincmd w' + exec 'silent! '.linenum.' | normal! '.normcmd + + if !Tex_GetVarValue('Tex_ShowErrorContext') + pclose! + endif +endfunction " }}} +" Tex_SetCompilerMaps: sets maps for compiling/viewing/searching {{{ +" Description: +function! Tex_SetCompilerMaps() + if exists('b:Tex_doneCompilerMaps') + return + endif + let s:ml = exists('g:mapleader') ? g:mapleader : "\\" + + nnoremap Tex_Compile :call Tex_RunLaTeX() + vnoremap Tex_Compile :call Tex_PartCompile() + nnoremap Tex_View :call Tex_ViewLaTeX() + nnoremap Tex_ForwardSearch :call Tex_ForwardSearchLaTeX() + + call Tex_MakeMap(s:ml."ll", "Tex_Compile", 'n', '') + call Tex_MakeMap(s:ml."ll", "Tex_Compile", 'v', '') + call Tex_MakeMap(s:ml."lv", "Tex_View", 'n', '') + call Tex_MakeMap(s:ml."ls", "Tex_ForwardSearch", 'n', '') +endfunction +" }}} + +augroup LatexSuite + au LatexSuite User LatexSuiteFileType + \ call Tex_Debug('compiler.vim: Catching LatexSuiteFileType event', 'comp') | + \ call Tex_SetCompilerMaps() +augroup END + +command! -nargs=0 -range=% TPartCompile :, silent! call Tex_PartCompile() +" Setting b:fragmentFile = 1 makes Tex_CompileLatex consider the present file +" the _main_ file irrespective of the presence of a .latexmain file. +command! -nargs=0 TCompileThis let b:fragmentFile = 1 +command! -nargs=0 TCompileMainFile let b:fragmentFile = 0 + +" vim:fdm=marker:ff=unix:noet:ts=4:sw=4 diff --git a/dot_vim/ftplugin/latex-suite/custommacros.vim b/dot_vim/ftplugin/latex-suite/custommacros.vim new file mode 100644 index 0000000..1b1c6bd --- /dev/null +++ b/dot_vim/ftplugin/latex-suite/custommacros.vim @@ -0,0 +1,257 @@ +"============================================================================= +" File: custommacros.vim +" Author: Mikolaj Machowski +" Version: 1.0 +" Created: Tue Apr 23 05:00 PM 2002 PST +" CVS: $Id: custommacros.vim 997 2006-03-20 09:45:45Z srinathava $ +" +" Description: functions for processing custom macros in the +" latex-suite/macros directory +"============================================================================= + +let s:path = expand(':p:h') + +" Set path to macros dir dependent on OS {{{ +if has("unix") || has("macunix") + let s:macrodirpath = $HOME."/.vim/ftplugin/latex-suite/macros/" +elseif has("win32") + if exists("$HOME") + let s:macrodirpath = $HOME."/vimfiles/ftplugin/latex-suite/macros/" + else + let s:macrodirpath = $VIM."/vimfiles/ftplugin/latex-suite/macros/" + endif +endif + +" }}} +" SetCustomMacrosMenu: sets up the menu for Macros {{{ +function! SetCustomMacrosMenu() + let flist = Tex_FindInRtp('', 'macros') + exe 'amenu '.g:Tex_MacrosMenuLocation.'&New :call NewMacro("FFFromMMMenu")' + exe 'amenu '.g:Tex_MacrosMenuLocation.'&Redraw :call RedrawMacro()' + + let i = 1 + while 1 + let fname = Tex_Strntok(flist, ',', i) + if fname == '' + break + endif + exe "amenu ".g:Tex_MacrosMenuLocation."&Delete.&".i.":".fname." :call DeleteMacro('".fname."')" + exe "amenu ".g:Tex_MacrosMenuLocation."&Edit.&".i.":".fname." :call EditMacro('".fname."')" + exe "imenu ".g:Tex_MacrosMenuLocation."&".i.":".fname." =ReadMacro('".fname."')" + exe "nmenu ".g:Tex_MacrosMenuLocation."&".i.":".fname." i=ReadMacro('".fname."')" + let i = i + 1 + endwhile +endfunction + +if g:Tex_Menus + call SetCustomMacrosMenu() +endif + +" }}} +" NewMacro: opens new file in macros directory {{{ +function! NewMacro(...) + " Allow for calling :TMacroNew without argument or from menu and prompt + " for name. + if a:0 > 0 + let newmacroname = a:1 + else + let newmacroname = input("Name of new macro: ") + if newmacroname == '' + return + endif + endif + + if newmacroname == "FFFromMMMenu" + " Check if NewMacro was called from menu and prompt for insert macro + " name + let newmacroname = input("Name of new macro: ") + if newmacroname == '' + return + endif + elseif Tex_FindInRtp(newmacroname, 'macros') != '' + " If macro with this name already exists, prompt for another name. + exe "echomsg 'Macro ".newmacroname." already exists. Try another name.'" + let newmacroname = input("Name of new macro: ") + if newmacroname == '' + return + endif + endif + exec 'split '.Tex_EscapeSpaces(s:macrodirpath.newmacroname) + setlocal filetype=tex +endfunction + +" }}} +" RedrawMacro: refreshes macro menu {{{ +function! RedrawMacro() + aunmenu TeX-Suite.Macros + call SetCustomMacrosMenu() +endfunction + +" }}} +" ChooseMacro: choose a macro file {{{ +" " Description: +function! s:ChooseMacro(ask) + let filelist = Tex_FindInRtp('', 'macros') + let filename = Tex_ChooseFromPrompt( + \ a:ask."\n" . + \ Tex_CreatePrompt(filelist, 2, ',') . + \ "\nEnter number or filename :", + \ filelist, ',') +endfunction + +" }}} +" DeleteMacro: deletes macro file {{{ +function! DeleteMacro(...) + if a:0 > 0 + let filename = a:1 + else + let filename = s:ChooseMacro('Choose a macro file for deletion :') + endif + + if !filereadable(s:macrodirpath.filename) + " When file is not in local directory decline to remove it. + call confirm('This file is not in your local directory: '.filename."\n". + \ 'It will not be deleted.' , '&OK', 1) + + else + let ch = confirm('Really delete '.filename.' ?', "&Yes\n&No", 2) + if ch == 1 + call delete(s:macrodirpath.filename) + endif + call RedrawMacro() + endif +endfunction + +" }}} +" EditMacro: edits macro file {{{ +function! EditMacro(...) + if a:0 > 0 + let filename = a:1 + else + let filename = s:ChooseMacro('Choose a macro file for insertion:') + endif + + if filereadable(s:macrodirpath.filename) + " If file exists in local directory open it. + exec 'split '.Tex_EscapeSpaces(s:macrodirpath.filename) + else + " But if file doesn't exist in local dir it probably is in user + " restricted area. Instead opening try to copy it to local dir. + " Pity VimL doesn't have mkdir() function :) + let ch = confirm("You are trying to edit file which is probably read-only.\n". + \ "It will be copied to your local LaTeX-Suite macros directory\n". + \ "and you will be operating on local copy with suffix -local.\n". + \ "It will succeed only if ftplugin/latex-suite/macros dir exists.\n". + \ "Do you agree?", "&Yes\n&No", 1) + if ch == 1 + " But there is possibility we already created local modification. + " Check it and offer opening this file. + if filereadable(s:macrodirpath.filename.'-local') + let ch = confirm('Local version of '.filename." already exists.\n". + \ 'Do you want to open it or overwrite with original version?', + \ "&Open\nOver&write\n&Cancel", 1) + if ch == 1 + exec 'split '.Tex_EscapeSpaces(s:macrodirpath.filename.'-local') + elseif ch == 2 + new + exe '0read '.Tex_FindInRtp(filename, 'macros') + " This is possible macro was edited before, wipe it out. + if bufexists(s:macrodirpath.filename.'-local') + exe 'bwipe '.s:macrodirpath.filename.'-local' + endif + exe 'write! '.s:macrodirpath.filename.'-local' + else + return + endif + else + " If file doesn't exist, open new file, read in system macro and + " save it in local macro dir with suffix -local + new + exe '0read '.Tex_FindInRtp(filename, 'macros') + exe 'write '.s:macrodirpath.filename.'-local' + endif + endif + + endif + setlocal filetype=tex +endfunction + +" }}} +" ReadMacro: reads in a macro from a macro file. {{{ +" allowing for placement via placeholders. +function! ReadMacro(...) + + if a:0 > 0 + let filename = a:1 + else + let filelist = Tex_FindInRtp('', 'macros') + let filename = + \ Tex_ChooseFromPrompt("Choose a macro file:\n" . + \ Tex_CreatePrompt(filelist, 2, ',') . + \ "\nEnter number or name of file :", + \ filelist, ',') + endif + + let fname = Tex_FindInRtp(filename, 'macros', ':p') + + let markerString = '<---- Latex Suite End Macro ---->' + let _a = @a + let position = line('.').' | normal! '.virtcol('.').'|' + silent! call append(line('.'), markerString) + silent! exec "read ".fname + silent! exec "normal! V/^".markerString."$/-1\\"ax" + " This is kind of tricky: At this stage, we are one line after the one we + " started from with the marker text on it. We need to + " 1. remove the marker and the line. + " 2. get focus to the previous line. + " 3. not remove anything from the previous line. + silent! exec "normal! $v0k$\"_x" + + call Tex_CleanSearchHistory() + + let @a = substitute(@a, '['."\n\r\t ".']*$', '', '') + let textWithMovement = IMAP_PutTextWithMovement(@a) + let @a = _a + + return textWithMovement + +endfunction + +" }}} +" commands for macros {{{ +com! -nargs=? TMacroNew :call NewMacro() + +" This macros had to have 2 versions: +if v:version >= 602 + com! -complete=custom,Tex_CompleteMacroName -nargs=? TMacro + \ :let s:retVal = ReadMacro() normal! i=s:retVal + com! -complete=custom,Tex_CompleteMacroName -nargs=? TMacroEdit + \ :call EditMacro() + com! -complete=custom,Tex_CompleteMacroName -nargs=? TMacroDelete + \ :call DeleteMacro() + + " Tex_CompleteMacroName: for completing names in TMacro... commands {{{ + " Description: get list of macro names with Tex_FindInRtp(), remove full path + " and return list of names separated with newlines. + " + function! Tex_CompleteMacroName(A,P,L) + " Get name of macros from all runtimepath directories + let macronames = Tex_FindInRtp('', 'macros') + " Separate names with \n not , + let macronames = substitute(macronames,',','\n','g') + return macronames + endfunction + + " }}} + +else + com! -nargs=? TMacro + \ :let s:retVal = ReadMacro() normal! i=s:retVal + com! -nargs=? TMacroEdit :call EditMacro() + com! -nargs=? TMacroDelete :call DeleteMacro() + +endif + +" }}} + +" vim:fdm=marker:ff=unix:noet:ts=4:sw=4 diff --git a/dot_vim/ftplugin/latex-suite/diacritics.vim b/dot_vim/ftplugin/latex-suite/diacritics.vim new file mode 100644 index 0000000..616d30a --- /dev/null +++ b/dot_vim/ftplugin/latex-suite/diacritics.vim @@ -0,0 +1,124 @@ +"============================================================================= +" File: diacritics.vim +" Author: Lubomir Host +" Created: Tue Apr 23 07:00 PM 2002 PST +" +" Description: shortcuts for all diacritics. +"============================================================================= + +if !g:Tex_Diacritics + finish +endif + +" \'{a} {{{ +call IMAP ('=a', "\\\'{a}", 'tex') +call IMAP ('=b', "\\'{b}", 'tex') +call IMAP ('=c', "\\'{c}", 'tex') +call IMAP ('=d', "\\'{d}", 'tex') +call IMAP ('=e', "\\'{e}", 'tex') +call IMAP ('=f', "\\'{f}", 'tex') +call IMAP ('=g', "\\'{g}", 'tex') +call IMAP ('=h', "\\'{h}", 'tex') +call IMAP ('=i', "\\'{\i}", 'tex') +call IMAP ('=j', "\\'{j}", 'tex') +call IMAP ('=k', "\\'{k}", 'tex') +call IMAP ('=l', "\\'{l}", 'tex') +call IMAP ('=m', "\\'{m}", 'tex') +call IMAP ('=n', "\\'{n}", 'tex') +call IMAP ('=o', "\\'{o}", 'tex') +call IMAP ('=p', "\\'{p}", 'tex') +call IMAP ('=q', "\\'{q}", 'tex') +call IMAP ('=r', "\\'{r}", 'tex') +call IMAP ('=s', "\\'{s}", 'tex') +call IMAP ('=t', "\\'{t}", 'tex') +call IMAP ('=u', "\\'{u}", 'tex') +call IMAP ('=v', "\\'{v}", 'tex') +call IMAP ('=w', "\\'{w}", 'tex') +call IMAP ('=x', "\\'{x}", 'tex') +call IMAP ('=y', "\\'{y}", 'tex') +call IMAP ('=z', "\\'{z}", 'tex') +call IMAP ('=A', "\\'{A}", 'tex') +call IMAP ('=B', "\\'{B}", 'tex') +call IMAP ('=C', "\\'{C}", 'tex') +call IMAP ('=D', "\\'{D}", 'tex') +call IMAP ('=E', "\\'{E}", 'tex') +call IMAP ('=F', "\\'{F}", 'tex') +call IMAP ('=G', "\\'{G}", 'tex') +call IMAP ('=H', "\\'{H}", 'tex') +call IMAP ('=I', "\\'{\I}", 'tex') +call IMAP ('=J', "\\'{J}", 'tex') +call IMAP ('=K', "\\'{K}", 'tex') +call IMAP ('=L', "\\'{L}", 'tex') +call IMAP ('=M', "\\'{M}", 'tex') +call IMAP ('=N', "\\'{N}", 'tex') +call IMAP ('=O', "\\'{O}", 'tex') +call IMAP ('=P', "\\'{P}", 'tex') +call IMAP ('=Q', "\\'{Q}", 'tex') +call IMAP ('=R', "\\'{R}", 'tex') +call IMAP ('=S', "\\'{S}", 'tex') +call IMAP ('=T', "\\'{T}", 'tex') +call IMAP ('=U', "\\'{U}", 'tex') +call IMAP ('=V', "\\'{V}", 'tex') +call IMAP ('=W', "\\'{W}", 'tex') +call IMAP ('=X', "\\'{X}", 'tex') +call IMAP ('=Y', "\\'{Y}", 'tex') +call IMAP ('=Z', "\\'{Z}", 'tex') +" }}} +" \v{a} {{{ +call IMAP ('+a', "\\v{a}", 'tex') +call IMAP ('+b', "\\v{b}", 'tex') +call IMAP ('+c', "\\v{c}", 'tex') +call IMAP ('+d', "\\v{d}", 'tex') +call IMAP ('+e', "\\v{e}", 'tex') +call IMAP ('+f', "\\v{f}", 'tex') +call IMAP ('+g', "\\v{g}", 'tex') +call IMAP ('+h', "\\v{h}", 'tex') +call IMAP ('+i', "\\v{\i}", 'tex') +call IMAP ('+j', "\\v{j}", 'tex') +call IMAP ('+k', "\\v{k}", 'tex') +call IMAP ('+l', "\\q l", 'tex') +call IMAP ('+m', "\\v{m}", 'tex') +call IMAP ('+n', "\\v{n}", 'tex') +call IMAP ('+o', "\\v{o}", 'tex') +call IMAP ('+p', "\\v{p}", 'tex') +call IMAP ('+q', "\\v{q}", 'tex') +call IMAP ('+r', "\\v{r}", 'tex') +call IMAP ('+s', "\\v{s}", 'tex') +call IMAP ('+t', "\\q t", 'tex') +call IMAP ('+u', "\\v{u}", 'tex') +call IMAP ('+v', "\\v{v}", 'tex') +call IMAP ('+w', "\\v{w}", 'tex') +call IMAP ('+x', "\\v{x}", 'tex') +call IMAP ('+y', "\\v{y}", 'tex') +call IMAP ('+z', "\\v{z}", 'tex') +call IMAP ('+A', "\\v{A}", 'tex') +call IMAP ('+B', "\\v{B}", 'tex') +call IMAP ('+C', "\\v{C}", 'tex') +call IMAP ('+D', "\\v{D}", 'tex') +call IMAP ('+E', "\\v{E}", 'tex') +call IMAP ('+F', "\\v{F}", 'tex') +call IMAP ('+G', "\\v{G}", 'tex') +call IMAP ('+H', "\\v{H}", 'tex') +call IMAP ('+I', "\\v{\I}", 'tex') +call IMAP ('+J', "\\v{J}", 'tex') +call IMAP ('+K', "\\v{K}", 'tex') +call IMAP ('+L', "\\v{L}", 'tex') +call IMAP ('+M', "\\v{M}", 'tex') +call IMAP ('+N', "\\v{N}", 'tex') +call IMAP ('+O', "\\v{O}", 'tex') +call IMAP ('+P', "\\v{P}", 'tex') +call IMAP ('+Q', "\\v{Q}", 'tex') +call IMAP ('+R', "\\v{R}", 'tex') +call IMAP ('+S', "\\v{S}", 'tex') +call IMAP ('+T', "\\v{T}", 'tex') +call IMAP ('+U', "\\v{U}", 'tex') +call IMAP ('+V', "\\v{V}", 'tex') +call IMAP ('+W', "\\v{W}", 'tex') +call IMAP ('+X', "\\v{X}", 'tex') +call IMAP ('+Y', "\\v{Y}", 'tex') +call IMAP ('+Z', "\\v{Z}", 'tex') +" }}} +call IMAP ('+}', "\\\"{a}", 'tex') +call IMAP ('+:', "\\^{o}", 'tex') + +" vim:fdm=marker:ff=unix:noet:ts=4:sw=4 diff --git a/dot_vim/ftplugin/latex-suite/dictionaries/SIunits b/dot_vim/ftplugin/latex-suite/dictionaries/SIunits new file mode 100644 index 0000000..d4ac081 --- /dev/null +++ b/dot_vim/ftplugin/latex-suite/dictionaries/SIunits @@ -0,0 +1,289 @@ +addprefix +addunit +ampere +amperemetresecond +amperepermetre +amperepermetrenp +amperepersquaremetre +amperepersquaremetrenp +angstrom +arad +arcminute +arcsecond +are +atomicmass +atto +attod +barn +bbar +becquerel +becquerelbase +bel +candela +candelapersquaremetre +candelapersquaremetrenp +celsius +Celsius +celsiusbase +centi +centid +coulomb +coulombbase +coulombpercubicmetre +coulombpercubicmetrenp +coulombperkilogram +coulombperkilogramnp +coulombpermol +coulombpermolnp +coulombpersquaremetre +coulombpersquaremetrenp +cubed +cubic +cubicmetre +cubicmetreperkilogram +cubicmetrepersecond +curie +dday +deca +decad +deci +decid +degree +degreecelsius +deka +dekad +derbecquerel +dercelsius +dercoulomb +derfarad +dergray +derhenry +derhertz +derjoule +derkatal +derlumen +derlux +dernewton +derohm +derpascal +derradian +dersiemens +dersievert +dersteradian +dertesla +dervolt +derwatt +derweber +electronvolt +exa +exad +farad +faradbase +faradpermetre +faradpermetrenp +femto +femtod +fourth +gal +giga +gigad +gram +graybase +graypersecond +graypersecondnp +hectare +hecto +hectod +henry +henrybase +henrypermetre +henrypermetrenp +hertz +hertzbase +hour +joule +joulebase +joulepercubicmetre +joulepercubicmetrenp +jouleperkelvin +jouleperkelvinnp +jouleperkilogram +jouleperkilogramkelvin +jouleperkilogramkelvinnp +jouleperkilogramnp +joulepermole +joulepermolekelvin +joulepermolekelvinnp +joulepermolenp +joulepersquaremetre +joulepersquaremetrenp +joulepertesla +jouleperteslanp +katal +katalbase +katalpercubicmetre +katalpercubicmetrenp +kelvin +kilo +kilod +kilogram +kilogrammetrepersecond +kilogrammetrepersecondnp +kilogrammetrepersquaresecond +kilogrammetrepersquaresecondnp +kilogrampercubicmetre +kilogrampercubicmetrecoulomb +kilogrampercubicmetrecoulombnp +kilogrampercubicmetrenp +kilogramperkilomole +kilogramperkilomolenp +kilogrampermetre +kilogrampermetrenp +kilogrampersecond +kilogrampersecondcubicmetre +kilogrampersecondcubicmetrenp +kilogrampersecondnp +kilogrampersquaremetre +kilogrampersquaremetrenp +kilogrampersquaremetresecond +kilogrampersquaremetresecondnp +kilogramsquaremetre +kilogramsquaremetrenp +kilogramsquaremetrepersecond +kilogramsquaremetrepersecondnp +kilowatthour +liter +litre +lumen +lumenbase +lux +luxbase +mega +megad +meter +metre +metrepersecond +metrepersecondnp +metrepersquaresecond +metrepersquaresecondnp +micro +microd +milli +millid +minute +mole +molepercubicmetre +molepercubicmetrenp +nano +nanod +neper +newton +newtonbase +newtonmetre +newtonpercubicmetre +newtonpercubicmetrenp +newtonperkilogram +newtonperkilogramnp +newtonpermetre +newtonpermetrenp +newtonpersquaremetre +newtonpersquaremetrenp +NoAMS +no@qsk +ohm +ohmbase +ohmmetre +one +paminute +pascal +pascalbase +pascalsecond +pasecond +per +period@active +persquaremetresecond +persquaremetresecondnp +peta +petad +pico +picod +power +@qsk +quantityskip +rad +radian +radianbase +radianpersecond +radianpersecondnp +radianpersquaresecond +radianpersquaresecondnp +reciprocal +rem +roentgen +rp +rpcubed +rpcubic +rpcubicmetreperkilogram +rpcubicmetrepersecond +rperminute +rpersecond +rpfourth +rpsquare +rpsquared +rpsquaremetreperkilogram +second +siemens +siemensbase +sievert +sievertbase +square +squared +squaremetre +squaremetrepercubicmetre +squaremetrepercubicmetrenp +squaremetrepercubicsecond +squaremetrepercubicsecondnp +squaremetreperkilogram +squaremetrepernewtonsecond +squaremetrepernewtonsecondnp +squaremetrepersecond +squaremetrepersecondnp +squaremetrepersquaresecond +squaremetrepersquaresecondnp +steradian +steradianbase +tera +terad +tesla +teslabase +ton +tonne +unit +unitskip +usk +volt +voltbase +voltpermetre +voltpermetrenp +watt +wattbase +wattpercubicmetre +wattpercubicmetrenp +wattperkilogram +wattperkilogramnp +wattpermetrekelvin +wattpermetrekelvinnp +wattpersquaremetre +wattpersquaremetrenp +wattpersquaremetresteradian +wattpersquaremetresteradiannp +weber +weberbase +yocto +yoctod +yotta +yottad +zepto +zeptod +zetta +zettad diff --git a/dot_vim/ftplugin/latex-suite/dictionaries/dictionary b/dot_vim/ftplugin/latex-suite/dictionaries/dictionary new file mode 100644 index 0000000..458dc0b --- /dev/null +++ b/dot_vim/ftplugin/latex-suite/dictionaries/dictionary @@ -0,0 +1,677 @@ +abbrv +abovedisplayshortskip +abovedisplayskip +abstract +abstract +abstractname +acute +addcontentsline +address +addtime +addtocontents +addtocounter +addtolength +addvspace +align +alph +Alph +alpha +amsmath +amsthm +and +appendix +appendixname +arabic +array +arraycolsep +arrayrulewidth +arraystretch +article +author +a4paper +a5paper +backmatter +bar +bar +baselineskip +baselinestretch +batchmode +begin +belowdisplayshortskip +belowdisplayskip +bezier +bf +bfseries +bibindent +bibitem +bibliography +bibliographystyle +bibname +big +Big +Bigg +bigg +Biggl +biggl +Biggm +biggm +Biggr +biggr +Bigl +bigl +bigm +Bigm +bigr +Bigr +bigskip +bigskipamount +binom +blg +boldmath +boldsymbol +book +botfigrule +bottmofraction +bottomnumber +boxedminipage +bp +breve +b5paper +calc +calc +caption +caption2 +capt-of +cases +cc +ccaption +ccname +cdotscenter +centering +cercle +cfrac +changebar +chapter +chapterbib +chaptername +check +cite +cleardoublepage +clearpage +cline +clock +closing +cm +COLON +columnsep +columnseprule +columnwidth +contentsline +contentsname +copyright +dag +dashbox +date +dbinom +dblfigure +dblfloatpage +dblfloatsep +dbltextfloatsep +dbltopfraction +dbltopnumber +dcolumn +dd +ddag +ddot +ddots +DeclareMathOperator +depth +description +dfrac +displaylimits +displaymath +displaystyle +document +documentclass +dot +dotfill +doublerulesep +downbracefill +draft +dropping +dywiz +em +emph +empty +encl +enclname +end +endfloat +enlargethispage +enskip +enspace +ensuremath +enumerate +enumi +enumii +enumiii +enumiv +eqnarray +equation +errorstopmode +eucal +eufrak +evensidemargin +everyship +ex +executivepaper +expdlist +extracolsep +extramark +fancybox +fancyhdr +fbox +fboxrule +fboxsep +figure +figurename +file +filecontents +final +flafter +fleqn +floatflt +floatpagefraction +floatsep +flushbottom +flushleft +flushright +fnpara +fnsymbol +fn2end +fontenc +footheight +footmisc +footnote +footnotemark +footnoterule +footnotesep +footnotesize +footnotetext +footnpag +footskip +frac +frame +framebox +frenchspacing +frontmatter +ftnright +fussy +gather +genfrac +geometry +glossary +glossaryentry +graphicx +graphpaper +grave +hat +hbox +headheihgt +headings +headsep +height +helvet +hfill +hhline +hline +hrulefill +hspace +huge +Huge +HUGE +hyperref +hyphenation +ifthen +in +include +includeonly +indent +indentfirst +index +indexentry +indexname +indexspace +input +inputenc +intertext +intextsep +invisible +it +item +itemindent +itemize +itemsep +itshape +jot +kill +label +labelenumi +labelenumii +labelenumiii +labelenumiv +labelitemi +labelitemii +labelitemiii +labelitemiv +labelsep +labelwidth +landscape +large +LARGE +Large +LaTeX +LaTeXe +latexsym +ldots +left +leftarrowfill +lefteqn +leftmargin +leftmargini +leftmarginii +leftmarginiii +leftmarginiv +leftmarginv +leftmarginvi +leftmark +legalpaper +leq +leqno +letter +letterpaper +letterspace +lhead +limits +line +linebreak +linethickness +linewidth +list +listfigurename +listfiles +listoffigures +listoftables +listparindent +location +longtable +lq +lrbox +lscape +mainmatter +makeatletter +makeatother +makebox +makeglossary +makeidx +makeindex +makelabel +maketitle +manyfoot +marginpar +marginparpush +marginparsep +marginparwidth +markboth +markleft +markright +math +mathbb +mathbf +mathbin +mathcal +mathclose +mathfrak +mathindent +mathit +mathnormal +mathop +mathopen +mathord +mathpunct +mathrel +mathrm +mathscr +mathsf +mathstrut +mathtt +mathversion +mbox +mdseries +medmuskip +medskip +medskipamount +minipage +minitoc +minus +mkern +mm +moreverbatim +mpfootnote +mu +multicol +multicolumn +multilanguage +multiput +multirow +myheadings +nabla +name +NeedsTeXFormat +newcommand +newcounter +newenvironment +newfont +newlength +newline +newpage +newsavebox +newtheorem +nocite +nofiles +noindent +nolimits +nolinebreak +nomathsymbols +nonfrenchspacing +nonumber +nopagebreak +normalfont +normalsize +not +notag +note +notitlepage +nu +numberline +numline +numprint +oddsidemargin +oldstyle +onecolumn +oneside +onlynotes +onlyslides +openany +openbib +opening +openright +operatorname +oval +overbrace +overlay +overleftarrow +overline +overrightarrow +page +pagebreak +pagenumbering +pageref +pagestyle +paperheight +paperwidth +par +paragraph +parbox +parbox +parindent +parsep +parskip +part +partial +partname +partopsep +pauza +pc +phi +pi +picture +plain +PLdateending +plmath +PLSlash +plus +pmb +pmod +polski +polski +poptabs +pounds +ppauza +prefixing +printindex +protect +providecommand +ps +pt +pushtabs +put +qbezier +qbeziermax +qquad +quad +quotation +quote +raggedbottom +raggedleft +raggedright +ragged2e +raisebox +ratio +real +ref +refname +refstepcounter +relsize +renewcommand +renewenvironment +report +reversemarginpar +rhead +right +rightarrowfill +rightmargin +rightmark +rm +rmfamily +roman +Roman +rotate +rotating +rq +rule +samepage +savebox +sb +sbox +sc +scriptscriptstyle +scriptsize +scriptstyle +scrollmode +scshape +secnumdepth +section +sectionmark +see +seename +selectfont +selectlanguage +setcounter +setlength +settime +settodepth +settoheight +settowidth +sf +sffamily +shadethm +shadow +shapepar +shortstack +showlabels +sidecap +signature +sin +sl +slide +slides +sloppy +sloppybar +slshape +small +smallskip +smallskipamount +soul +sp +space +sqrt +ss +SS +stackrel +startbreaks +stepcounter +stop +stopbreaks +stretch +strut +subfigure +subfigure +subitem +subparagraph +subsection +subsubitem +subsubsection +sum +supressfloats +symbol +symbol +tabbing +tabcolsep +table +tablename +tableofcontents +tabular +tabularx +tag +tan +tbinom +telephone +TeX +textbf +textbullet +textcircled +textcompwordmark +textemdash +textendash +textexclamdown +textfloatsep +textfraction +textheight +textit +textmd +textnormal +textperiodcenter +textquestiondown +textquotedblleft +textquotedblright +textquoteleft +textquoteright +textrm +textsc +textsf +textsl +textstyle +textsuperscript +texttt +textup +textvisiblespace +textwidth +tfrac +thanks +the +thebibliography +theindex +theorem +thepage +thesection +theta +thicklines +thickmuskip +thinlines +thispagestyle +tilde +time +times +tiny +title +titlepage +tocdepth +today +topfigrule +topfraction +topmargin +topmargin +topmargin +topsep +topskip +topskip +totalheight +totalnumber +trivlist +tt +ttfamily +twocolumn +twocolumn +twoside +typein +typein +typeout +typeout +ulem +ulem +unboldmath +underbrace +underline +unsort +unsrt +upbracefill +upshape +upshape +usebox +usebox +usecounter +usefont +usepackage +value +vbox +vdots +vec +vector +verb +verb +verbatim +verse +vfill +visible +vline +vmargin +voffset +vspace +widehat +widetilde +width +wrapfig +xleftarrow +xrightarrow +threeparttable diff --git a/dot_vim/ftplugin/latex-suite/elementmacros.vim b/dot_vim/ftplugin/latex-suite/elementmacros.vim new file mode 100644 index 0000000..8960a0f --- /dev/null +++ b/dot_vim/ftplugin/latex-suite/elementmacros.vim @@ -0,0 +1,338 @@ +"============================================================================= +" File: elementmacros.vim +" Author: Mikolaj Machowski +" Created: Tue Apr 23 06:00 PM 2002 PST +" +" Description: macros for dimensions/fonts/counters. +" and various common commands such ref/label/footnote. +"============================================================================= + +nmap