by Marcin Szamotulski
atp-vim-list [AT] lists.sourceforge.net
If you found this plugin useful or you have any kind of problems with running it or some ideas to share, you are cordially invited to write to me: mszamot@gmail.com. Voting at Vim site is also welcome ;) .
This is a filetype plugin for Vim to comfortably write [TeX], [LaTeX], [PdfLaTeX],... documents, which provides functionality not met in other plugins. It makes you [FREE] from compiling procedure, making this process automatic using autocommands. It also provides useful mappings and other many other commands: to analyse your .log file, to see the table contents, to search for a label, to search in bib files or to find a macro definition matching a pattern, or even to find and preview fonts in your tex distribution. The features include a multi-functional tab completion for: commands, environment names, packages, input files, bib files, bst files, colours, closing brackets and environments (preserves nesting),... etc. To have full functionality you need: python (with nonstandard psutil library, see here how to get it), pdffonts available in the package 'app-text/poppler' (at least in Gentoo). Another good tool is texdoc, which is a part of TexLive - these days standard TeX distribution for Linux, and MikTeX on Windows.
You can [DONATE] for this project through your [PayPal] account (my email
is
Note: The donations are accepted through PayPal, if you are from Europe and you want to donate Euro, use your PayPal account rather than SourceForge link where you cannot donate Euro (avoiding twice money exchange).
- There is a mailing list which will serve for: feature requests, bug reports, suggestions. You can subscribe with this link
- For detailed list of changes you can look here
- Project news can be tracked through sourceforge watch feature (you need sourecforge account)
- SourceForge hosts stable releases (also available on Vim web page) but also snapshots of unstable developed new version. The snapshots might contains fixes and new features which might not yet work well, or might change (commands, maps, etc ...).
If you use <Shift-Tab> (i.e. non-expert mode for completion) to close a bracket, it will be put after the cursor, allowing you to write inside brackets. This doesn't work with \(:\) and other math pairs and closing environments.
Closing brackets with <Tab> is much faster now.
cmap <M-c> ^\%([^%]\|\\%\)* - useful when searching for sth which is not in a commented out.
Both vmap and imap for \overline and \underline are using g:atp_imap_over_leader.
The value of g:atp_MapSelectComment is now =c (it used to be _c) You can also use vip over commented lines to select them.
New math imaps: (atp-imaps-math)
| |- | \vdash |
| -| | \dashv |
| ++ | \sum (it is disabled now when typing X_++ or X^++) |
The command :Align (and thus also :TexAlign) are using ATP_strlen function to measure the string length. ATP sets g:Align_xstrlen="ATP_strlen" if 'conceallevel' option is >0. if 'conceallevel' is reset to 0 ATP_strlen behaves like g:Align_xstrlen=2.
:TOC and :Labels commands when open together will be in one column wtith table of contents at the top.
]*, ]%, [*, [% - skip comment maps, all works now in the same way. If g:atp_VimCompatible is 1 they go to where comment statrs/ends, if it is 0 they go one line above/below.
cmap <M-c> will insert a pattern which match lines which are not a comment.
See atp-completion-packages: the variable g:atp_package_{p_name}_command_values was added. Some new packages are now supported (for the completion).
You can read now about imaps implementation: atp-imaps. There are new font imaps: ##fr (\mathfrak{}) and #cr (\mathscr{}), see atp-imap-fonts. Also the imaps ##cal, ##fr, ##cr, ##bb when used in text mode will insert '\(' (or '$' for tex files), which opens the LaTeX math mode.
_> and <_ imaps for \Rightarrow and \Leftarrow.
Deleted some imaps to non existing uppercase greek letters. There are imaps togreek letters:
| \varpi | #vp |
| \varphi | #vf |
| \vartheta | #vo |
| \varsigma | #vs |
| \varepsilon | #ve |
The main change is the speed up of writing in insert mode by consolidation autocommands for CursorMovedI group and changing them when they are actually run. This is used for defining imaps, see atp-imaps, and for setting vim options in LaTeX math mode, see g:atp_MathVimOptions.
g:atp_no_python -- set this to one if you want to switch off python. (This is not yet well integrrated but might help).
New imap
The g:atp_imap_first_leader, g:atp_imap_second_leader, g:atp_imap_third_leader, g:atp_imap_fourth_leader variables are now called: g:atp_imap_leader_1, g:atp_imap_leader_2, g:atp_imap_leader_3, g:atp_imap_leader_4.
See b:atp_MaxProcesses and b:atp_KillYoungest.
The variables b:atp_TexOptions, b:atp_StarEnvDefault, b:atp_StarMathEnvDefault are added to g:atp_ProjectLocalVariables.
See g:atp_imap_diacritics_inteligent how to write diacritics with ATP.
Tikzpicture keyword completion is only active in non expert mode (atp-completion-non-expert-mode). See atp-completion-tikzpicture.
atp-:LocalCommands will make abbreviations to found environments.
See atp->f for two new motions made for beamer frame environment.
See atp-completion-documentclass-options, atp-completion-pacakages-options.
Q? and Q/ searching maps removed.
Some new imaps:
| `u | \underline{} |
| `o | \overline{} |
| `D | see in atp-imap-math-misc. |
+ Many Small Bug Fixes :)
The main work was to make ATP web page: http://atp-vim.sf.net with proper html version of documentation at http://atp-vim.sf.net/help.html.
New imaps added: see atp-imap-diacritics. Read also paragraph before atp-imap-math. The command atp-:ToggleMathIMaps is now called atp-:ToggleIMaps and also toggles atp-imap-diacritics.
I added to doc section about latexmk interface: atp-:Latexmk, atp-:LatexmkStatus, atp-:LatexmkClear, atp-:LatexmkStop. The LatexBox commands :LatexmkForce, :LatexmkStatusDetailed and :LatexmkClearAll are simulated with bang.
imap ++ \sum (which can be turned off with :ToggleIMaps or '
Several small fixes (thanks to user reports on the atp-mailing-list!)
Some functions where rewritten in python making ATP much faster.
ATP loads 1/3 faster (after first run when you save project file, which is done when you save your file!).
Use g:atp_no_local_abbreviations if you don't want to have abbreviations to locally defined environments (this takes time if your vim was compiled without |+python| feature, as it runs atp-:LocalCommands command - which is slow in this case).
Note: the python version of LocalCommands will save the current buffer, without saving project script and with 'nowritebackup' and 'nobackup' set.
I added b:atp_LocalEnvironments, b:atp_LocalCommands and b:atp_LocalColors to g:atp_ProjectLocalVariables if vim doesn't have +python feature otherwise g:atp_local_completion is set to 2, hence atp-:LocalCommands is run with BufEnter. It is so because the function LocalCommands was written also in python which is more than 10 times faster than the old vim implementation.
atp-:ViewOutput -- removed the [sync] argument.
atp-:BibSearch is written in python. It is much faster. Thus the argument should be a python regular expression. If you want to use vim script (and vim regular expression) set g:atp_bibsearch="vim". Then both Tab Completion and atp-:BibSearch will use vim code.
Tab completion for labels (\ref and \eqref commands) gives more information inside the popup menu.
The F2 map is back -- it turns on/off
Some other small fixes.
The keys j, k, gj and gk are no longer mapped by ATP. There is a better solution for updating the Table of Contents highlighted line. It is done using autocommand CursorHold.
See the new command atp-:Tags.
atp-:DsearchThis used to be :DefiSearch. This I found more in vim style. Also g:atp_DsearchMaxWindowHeight is used instead of g:atp_DefiSearchMaxWindowHeight.
g:atp_statusOutDir fixed.
g:atp_IMapCC instead of g:atp_MapCC.
And bunch of other fixes :).
Checkout cmdalias plugin (vimscript#745). It lets define lower case aliases to commands. You can put in your atprc file:
Thanks to Tim Harder there is a gentoo ebuild, if you use gentoo check for automatictexplugin in the portage tree.
Small but nice change in closing environments: If you type
\begin{envname}
Note: the format of viewer options has changed from a string to a vim list. Every option and its value should be placed as a separate element of vim list. See atp-Viewers_Options for examples.
New imaps for some commonly used math commands: see atp-imap-math.
All mathematical imaps: for symbols, greek letters, are defined only when inside LaTeX (or TeX) mathematical environment.
There is new predefined layout for environment imaps available, but disabled by default. If you like longer and more intuitive environment insert mode maps set g:atp_ShortEnvIMaps=0 in your vimrc or atprcc files. Use atp-:HelpEnvIMaps to see them. There is also one new environment ]let in this new layout which inputs a letter environment. If you want a short imap for it you can set g:atp_imap_letter="w" and ATP will make a map ]w for it. Note that "l", and "L" are already taken and using "le" will slow down "l", also "e" and "r" are used, so there is no good choice for it. You can set g:atp_letter_opening and g:atp_letter_closing to customize default opening and closing statements.
If you decide to use short imaps (the default) there is one change: ]i is mapped to \item and ]I is mapped to itemize environment (this is the only type of change in the short layout. In long layout ]I is mapped ot \item and ]ite is mapped to itemize environment.
There is also a small change with
The abbreviations are customizable: g:atp_imap_{envname}, also the
leader is customizable with g:atp_imap_third_leader and
environment names for example if you set g:atp_EnvNameTheorem="thm" then ]the
imap will insert \begin{thm}:\end{thm} pair. You can list supported
environments with ':let g:atp_EnvName
See also atp-:ToggleMathIMaps.
There are two more nice map
>E which is something like %>e, i.e. jump over the current environment and
go to next one. The reverse
atp--S, atp--s, atp--c, atp--p new maps for atp-:SSec, atp-:Sec, atp-:Chap and atp-:Part. They also works relatively to the current unit (section/chapter/part), i.e. 2]s will jump to second section of the current chapter.
b:atp_updatetime_insert can be changed on the fly to 0 (previously it requires to quitting vim and making changes in vimrc/atprc files.
atp-:MakeLatex is rewritten in python. The "!" is not yet implemented.
All python scripts are compatible with Python 3. Traceback info is forwarded to vim (and log files) in case exceptions are handled.
I added extended versions of dictionaries of latex-suite to ATP (the files dictionaries/dictionary and dictionary/SIunits). They are added to 'complete' vim option, so you can use them through ins-completion. I made one more dictionary (dictionaries/ams_dictionary) with ams commands and environment names. It will be added to the vim 'complete' option if you use amsmath package or if the document class is one of the standard ams classes or of g:atp_amsmath is set to 1.
Status notifications has the ability to show if b:atp_BibCompiler, or "makeindex" are running. Unless |g:atp_statusNotif|=0 or g:atp_callback=0 atp-:MakeLatex will echo a single message when it returns.
There is also new status line for QuickFix window with number of errors and warnings printed (this depends on b:atp_ErrorFormat).
Support for biber and biblatex is added (in atp-:MakeLatex, atp-:Bibtex, atp-:Delete, atp-:InputFiles commands), g:atp_keepp variable will adjust on the fly (add run.xml and bcf extensions). b:atp_BibCommand will be set to biber if the preamble contains \usepackage[backend=biber]{biblatex}
If you use biblatex, it allows for putting \bibliography{} type commands only in the preamble. Thus ATP will search for them only there. The g:atp_inputfile_pattern might not contain any pattern for bibliographies (\addbibresource, \bibliography, etc.). The atp-:InputFiles command will search for them in a special subroutine which only searches in the preamble. This makes it work slightly faster.
b:atp_TexOptions is a comma separated list of TeX compiler options. If you use g:atp_Compiler="bash" this might be just a white space separated list.
atp-spaceThe C-Space Vim, instead C-@ is used which works as C-Space. In Vim, and
gVim as well, you can also use atp-Q/, atp-Q? where
Note: from version 9.6 Space is mapped to \_s\+ in cmdline modes / and ?. F2 turns it on/off. The above maps are always on.
To get list of errors with current b:atp_ErrorFormat.
atp-:ErrorFormatThis is new interface to :SetErrorFormat. If {efm} is not given it will show the current value b:atp_ErrorFormat. It sets the variable b:atp_ErrorFormat and rereads the log file with |cgetfile|. The variable b:atp_ErrorFormat is also set when you use the command atp-:ShowErrors. In addition you can use +{flag} and -{flag} as an argument, then {flag} will be added/removed from b:atp_ErrorFormat.
If you want to use EaseMotion vim plugin (which is quite handy).
You can set g:atp_Compare="". Alternatively, if
you want to use the fastest comparing method of ATP, you can add to last line
of s:EasyMotion() function in plugin/EasyMotion.vim add
Select Comments nmap and vmap is now |_c| (previously \sc was interfering with an ATP font map).
(Almost all) maps became :map-silent.
The atprc file is now sourced twice at startup: at the beginning to set the variables, and once again at the end to set the maps defined in it.
Despite the status line for quick fix window, :cgetfile will be run when you open new files, this nicely works with :edit command but not :split if you want to keep the old log file in QuickFix window. If this is the case set
if you want to develop/debug ATP set g:atp_atpdev to 1 run atp-:ReloadATP and this command will allow to print (cat) debug files under g:atp_TempDir.
I hope I didn't missed anything important. If you want to see detailed changes you can always read the svn logs at atp-sourceforge.
If you do not like colours you can still set syntax on but clear the highlight colours (you should make a simple function which clears all the highlight groups, because ':hi clear' will not give you what you want).
See this link for other ATP requirements.
To get updates it is enought to use this command:
Unstable snapshots contain small fixes, and rarely, major changes of important parts of ATP (what can produce new bugs).
Requires python.
The main function is not seen by the user (it is called s:compiler, for those who want to read the plugin). It executes tex compiler specified by the variable b:atp_TexCompiler. It is executed as an autocommand by the line:
where s:auTeX() is a simple function which calls s:compiler if the file written on the disk and the buffer differ. There are two comparing mechanism, the default one is using b:changedtick-variable, the seconds compares the buffer with the on-disk version:
The default value is "changedtick". Then the |b:changedtick-variable| is used to find if there buffer differs and to run latex. With any other value a compare function will be used (which compares the buffer and the written file on the disk) - this method is much slower but has additional features: by default differences in comments are skipped (if you set g:atp_compare_embedded_comments=0 (the default is 1) then also the comments which do not start right at the beginning of line will be skipped). The second feature is to not see differences in amount of blank lines: two or more blank lines is the same as one blank line, for this set g:atp_compare_double_empty_lines=0, which is the default.
As you can see it will run if a key is not pressed during time defined by option 'updatetime' (see CursorHold) in the normal mode. If you type in insert mode the file won't be compiled (and that's all right as you can be in the middle of your very long formula). The value of 'updatetime' which works fine is around 1000ms ('updatetime' is set in milliseconds). Instead of setting 'updatetime' options directly you should set the variables b:atp_updatetime_insert and b:atp_updatetime_normal. Here's an important note on using CTRL-C (i_CTRL-C) in Vim:
In vim the key combination CTRL-C (|i_CTRL-C|) in insert mode exists to normal without triggering the InsertLeave autocommands. In this way it doesn't changes the 'updatetime' from |b:atp_updatetime_insert| to b:atp_updatetime_normal. If g:atp_IMapCC=1 then _CTRL-C is mapped to i_CTRL-[ so the InsertLeave autocommands are parsed. However, it is a good habit to use i_CTRL-C while you are writing/editing and i_CTRL-[ or i_ESC when you wish to see what you wrote (then TeX will be run quicker). If you follow this you can even set b:atp_updatetime_normal=1 (if you set it to 0 then the file will not be processed while Vim is in normal mode).
If you set b:atp_updatetime_insert=0 the TeX compiler will not be called while Vim is in the insert mode.
If you set b:atp_updatetime_normal=0 the TeX compiler will not be called while Vim is in the normal mode.
Tex compiler is run with one options:
The second important variable b:atp_TexCompiler configures if you use TeX, PdfTeX, LaTeX, PdfLaTeX and it should point to the program name so please do not use capital letters.
Next variable to set is b:atp_OutDir. It configures where TeX will put the output and where viewer and log analysing tools can find appropriate files.
The last top most important variable is g:atp_keep which is a list of extensions, by default it is
There are two function compile which can compile your tex file: one written in python (for portability reasons) and old one in bash. They work almost the same with one small difference. The python code has some vim enhancments (for example the progres bar).
The python code has a debug file compile.log under g:atp_TempDir will contain all the errors issued by python, and 'compile.py.debug' - debugging info printed by the compile.py script.
If for some reason you'd like to use the old 'bash' style script there is a variable:
The python script compile.py sends PID numbers of latex processes to vim variable b:atp_LatexPIDs. Then the function which makes the status line for ATP has a python code to check if the latex PIDs are still valid processes. This is more accurate than the method used with bash compiler (before running latex increase variable b:atp_running and decrease after getting signal that latex has ended). In many situations this was failing. The new method works better, however it shows that latex is running after slightly longer period of time (not that first python must run the script and then run latex).
See atp-requirements-python for nonstandard python libraries that are used by ATP.
By default the call back mechanism is turned on (g:atp_callback=1)
When call back mechanism is set, which is by default if you run gui version, if you invoke 'vim' from command line you need to add 'servername' variable, it might be desirable to alias Vim to to
Note: the 'verbose' mode in 'Vim' (in the console) needs to be run, when there is no other latex instance running. Now you get a message to wait until compilation ends. In future releases, a better solution will be worked out. Gui version 'gvim' works better (as it doesn't suspend the editor).
The background compilation is always done in g:atp_DefaultDebugMode. Unless it is set to 'verbose' in which case 'debug' mode is used.
See also atp-:copen.
You need g:atp_statusNotif=1 and g:atp_StatusLine=1 for this feature to work (see also |laststatus| on how to activate status line in Vim).
If there are many background processes the number which is shown belongs to the oldest process. (b:atp_ProgressBar is a dictionary { 'pid' : 'pagenr' } - status line shows max of pagenr's).
Note: the time between you start to compile and [1] appears in the status line is mostly the time when LaTeX is reading all the packages that you loaded in the preamble.
When compilations ends without errors (i.e. when quick fix list is empty for the current error format) t:atp_DebugMode falls back to g:atp_DefaultDebugMode.
When going out of debug/Debug modes cmdheight is set to g:atp_cmdheight value (with default value set from 'cmdheight' option on startup).
Note: if you change |cmdheight| you should also change g:atp_DefaultCmdHeight, unfortunately vim has not autocommand group event to do that automatically.
The height of the |quickfix| window will be one more than the length of quick fix list (|getqflist()|) but nor more than g:atp_DebugModeQuickFixHeight.
The variable b:atp_ReloadOnError if set to 1 (which is the default) reload the file even when the exit status of compiler was non zero. If set to 0, then the file will not be reloaded [actually for viewers other than Xpdf it will not be copied from the temporary directory, for Xpdf it will be copied but not reloaded).
There is also a variable which stores the last command which executed your tex compiler, see |g:atp_TexCommand|.
Without "!" it copies the aux file only if there are no compilation errors, with "!" it updates the aux file even if there were errors. This is done to make the labels completion work better, when there are errors they often affect the aux file in a way that interferes with atp-:Labels command.
If b:atp_OpenViewer=1 and there current viewer (b:Viewer) is not running on the output file then this function will open a viewer. By default b:atp_OpenViewer=0 and this feature is disabled.
The command :2TEX will call the compiler two times.
It is useful when you want to make the outline (using hyperref package) of your article in pdf files, the tex file has to be 'sourced' twice. To make the bibliography you can use |atp-:Bibtex|.
If {runs} > 5 it will be reduced to 5, to avoid running tex for hundreds (or event thousands) of times (what could happen otherwise by a mistake giving the range of the command to be the current line number).
The optional argument [debug_mode] has possible values: '', 'silent', 'debug', 'Debug', 'verbose'. When '' the current debug mode is used (t:atp_DebugMode). ( [debug_mode] can be suppressed to 's', 'd', 'D', 'v' or "si"/"sil"/"sile"/... etc.) See the description of atp-debug-mode.
\d is mapped to :TEX debug and \l to :TEX (thus it uses your default debug mode).
If aux or log files are loaded in a buffer then they will be deleted - this is a requirement of vimgrep internal grep command (other wise vimgrep will search in the buffer not the hard disk version and they may differ).
Returns with error message if log contains '! Emergency stop.'
If g:atp_Compiler = 'python' it uses the python script to compile document, if g:atp_Compiler = 'bash' it uses a bash command (UNIX only).
If you specify any value to the [debug_mode] option (for the values see atp-:TEX) In verbose mode (only the last time tex compiler will run in errorstop mode and echoed to the console). This gives you the chance to see the output of bibtex command (it will be also printed when latex ends).
If bibtex returns with non zero exit code, latex will not be run afterwards.
Wihtout BANG "!" If you want to just run bibtex use :Bibtex without bang.
The command :Bibtex will :call Bibtex(), while :Bibtex v (and :Bibtex [debug_mode]) will :call Bibtex(1)
The bang "!" is used in the same way as for atp-:TEX command.
For the description of optional argument [debug_mode] see atp-:TEX.
| e | - include errors |
| w | - include all warning messages |
| r | - include all reference warnings |
| c | - include all citations warnings |
| f | - include all font warnings |
| fi | - include font info massages |
| F | - show files listed in the log (messages which start with 'File: ') shows the files loaded by tex for example fd files that LaTeX is using |
| p | - show packages loaded by tex (messages which start with 'Package: ') |
| all | - show all above, |
| All | - show All the log file, |
| o | - open the log file in a new buffer (split). |
If none flag is given g:atp_DefaultErrorFormat value is used. If 'o' flag is used the split buffer with log message has a map 'q' to ':bd'. Example:
Note: this command works in quickfix window. It will change errorformat but will not reload quickfix list. Better use atp-:ErrorFormat instead.
ShowErrors maps:
<LocalLeader>e | view errors with current b:atp_ErrorFormat | :ShowErrors |
F6+e | to see all errors | :ShowErrors e |
F6+w | to see all warnings | :ShowErrors w |
F6+r | to see warnings coming from references or citations | :ShowErrors rc |
F6+f | to see font warnings | :ShowErrors f |
this is not a texloganalyzer mapping but it is a good place to mention it:
As an argument you mey use +{flag} and -{flag} then {flag} will be added/removed from |b:atp_ErrorFormat|, example:
You can also use the command ':Explore' to see log, aux, ... files (which is a part of 'netrw' Vim plugin).
In the log file there are some special tools to syncronize the tex source file and the Viewer (currently only Xpdf is supported) with log file: atp-:SyncTex (log) and atp-:SyncXpdf (log)) These tools can sync tex file/Xpdf automatically using autocommand group |CursorMoved|.
With bang [!] it opens new window if the file with error is not shown in the current tab page. Without bang it opens the file in the window where ':ShowErrors o' was used.
If you set g:atp_SyncLog = 1 (the default value is 0) then the source file will be syncronize with the log file via autocommand (with |CursorMoved|). This sets 'cursorline' option to indicate the corresponding line in the source file. When the log buffer becomes hidden this option should be unset.
To set g:atp_SyncLog you can use :Sync command. ':Sync' will toggle the value, ':Sync on' will set it to 1 and ':Sync off' will set it to 0.
If you set g:atp_developer = 1 this command will also go to files under texmf tree (packages and classes).
Note: you can also set reverse search for Okular and Xdvi, see atp-Viewers-Okular and atp-Viewers-Xdvi for an instruction how to do that. Xpdf doesn't support reverse searching.
Note: there is a bug in Xpdf, one canot sent commands to Xpdf to quickly. If the atp-:SyncTex command only updates the page, but doesn't shift it then you can try to set g:atp_XpdfSleepTime variable to something higher than the default 0.1 (this is sleep time between sending commands to Xpdf in seconds)
When the output file or the synctex file (.synctex.gz) doesn't exists then first it will be generated. It can also open the document if it is not yet opened.
Note: with bang atp-:SyncTex will not check if viewer is running.
Read atp-:SyncTex_with_Okular if you use Okular.
:SyncTex | (although dvi is using srcspecials rather than synctex) |
map t | |
nmap <S-LeftMouse> |
It reads the Xpdf viewer options from the variables b:atp_xpdfOptions and g:atp_xpdfOptions. Similarly for Okular.
The bib data will be appended to bibliography of the current document. If there are many bib files will get a choice which one to use. This command is also available in bib files. Without bang, i.e. "!", it writes and closes the bib buffer with it will leave you in unsaved bib file buffer. You will be also asked for the bib key, the default choice is to use the AMS bib key.
This command also works when you use \begin{bibliography} environment. But the default is to use a bib file. The obtained bibliographic reference is copied to the register g:atp_bibrefRegister (the default is "0" so you can paste it using Vim command 'p'). In addition, it is stored in the variable g:atp_bibref.
If a readable bib file was not found under one of path listed in of g:atp_bibinputs variable (see g:atp_bibinputs) it is classified as not readable.
This command uses kpsewhich to find in which path to find input files. Actually the path variables: g:atp_texinputs for input files and g:atp_bibinputs for bib files are used.
The bibliographic declared are also listed. The command searches for them in any directory listed in g:atp_bibinputs (see g:atp_bibinputs).
If g:atp_developer = 1 (default 0) then the map 'gf' can also open package files and document class files, but only when using 'gf' over \usepackage or \documentclass tex commands.
With bang "!" this command regenerates tree of files (this is important only in files with input lines), without it uses cached values (if they exist).
The current file is now shown with highlight group: |hl-WarningMsg|.
The variable g:atp_inputfile_pattern is used as a pattern to find input files. If you use 'biblatex' you do not need to put any pattern matching bibliographies (\addbibresource, \bibliography, ...), ATP has special way of dealing with them which is faster. If you use 'subfile' package ATP will add \\subfile pattern.
let g:atp_OpenTypeDict | = { | |
| \ "pdf" : "xpdf", | "ps" : "evince", | |
| \ "djvu": "djview", | "txt" : "split" , | |
| \ "tex" : "edit", | "dvi" : "xdvi -s 5" } |
Found files (all not just matching ones) are stored in the variable g:atp_Library. It is set by |globpath()| on g:atp_LibraryPath and then filtered, only files which extensions are given in g:atp_OpenTypeDict will be stored. This variable is restored by the global project script. You can use {bang} "!" to regenerate the library if it has changed. This is particularly useful as by default ATP remembers g:atp_Library in the common project script (see atp-ProjectScript).
If you set |g:atp_delete_output|=1 the function will delete also the current output file (but not any other!) and 'synctex.gz' file.
This is list of extensions which will not be removed when atp-:Delete is run without bang. You do not need to add "pdf" or "dvi", extensions.
If you specify the variable 'g:atp_ssh=
The command has completion for the names of printers (also remote
printers) and also other lpr options and its values, press
See |
For the predefined maps which use WrapSelection see below atp-maps-WrapSelection or use atp-:HelpVMaps.
The command arguments should be separated with commas and quoted
separately (see |
For the predefined maps which use atp-:WrapSelection see below atp-maps-InteligentWrapSelection or use atp-:HelpVMaps.
These are the provided maps in visual mode:
Another provided font wrapper:
stores the default encoding which is 'OT1', unless you use fontenc package, then the default for fontenc is used (the last defined in \usepackage[...]{fontenc} see the 'Latex2e font selection' /font user guide/ available on CTAN).
Other wrappers:
You can also use a wrapper which was yanked into register 'a':
Natbib as well as biblatex commands are supported (with exception of \cites, ... biblatex commands).
With bang the bibtags for \cite commands are not made. If you use more than one bibliography file searching to which of them it belongs might take some time. If this is the case and you do not want this kind of tags you can make the tag file faster.
Note: you might need to adjust 'iskeyword' Vim option. ATP is adding g:atp_separator to 'iskeyword' if g:atp_no_separator is 0.
Note!:In Vim 'iskeyword' by default contains '_'. It is disabled by the stadard tex syntax file (you do not want to include _ from _{} LaTeX construct into 'w' motion). So it is better to avoid it in label names, so that CTRL-] works well. If you need to add it use:
Note: the python script is sourced in the background. When the script finishes it will let you know. The tag file is not accessible until the script finishes.
Check out tag-and-searches how to use tags.
:LatexTags command is only defined if there was :Tags command defined.
The optional argument bang controls if the table of contents data base must be generated: by default map \t doesn't regenerate the toc data base (unless if it doesn't exist), :TOC command regenerate the data base, :TOC! not.
See atp-toc-window for commands and maps defined in the toc window.
TOC() supports many edited files. For example if you have in your buffer list two files a.tex and b.tex this command will produce table of contents of both of them. If you have just one opened window (excluding the ToC window) then pressing <space>, <enter>, p and q will take you to the right buffer (which will be read if is unloaded or hidden). If you split a window then <space>, <enter>, p, q will take you to the window from which you are coming. However, if you have two windows with two different buffers loaded they will act on the window with the matching buffer name.
The variable t:toc_window_width sets the width of table of contents window. By default t:toc_window_width=30. You can set a global variable g:toc_window_width to override the default value.
If you forget what are these mappings, write ':map
The key 's' shows the context of the label under the cursor (your current window splits).
The variable t:labels_window_width sets the width of labels window. By default t:labels_window_width=30. You can set a global variable g:labels_window_width to override the default value.
Without bang "!" the labels data base will not be generated. Difference of \t and \L is that \L regenerates the database (which is quite fast).
Note: You can also use a tag file and vim |tags| commands, see atp-:Tags.
{environment} can be also math or displayedmath. For convenience there are maps: }m and }M respectively.
If g:atp_mapNn is set to one (see atp-:ToggleNn) then this command is using atp-:S.
{environment} can be also math or displayedmath. For convenience there are maps: {m and {M respectively.
If g:atp_mapNn is set to one (see atp-:ToggleNn) then this command is using atp-:S.
The {section} argument for :F is one off: part/chapter/section/subsection/subsubsection.
| Map | Command | Meaning |
>p | :NPart | go to next part |
>c | :NChap | go to next chapter |
>s | :NSec | go to next section |
>S | :NSSec | go to next subsection |
You can set the leader '>' using g:atp_map_forward_motion_leaderr variable.
Note: If you leave the default value of g:atp_map_forward_motion_leader then ATP remaps |>>| to >> and also |v_>| to >>. |>| is working and is not touched by ATP. If you have |'timeout'| set then the map is executed faster, if you use |'notimeout'| this workaround it makes these operators work.
Note: If you set g:atp_map_forward_motion_leader="}" then ATP remaps |}| operator to }}
Note: the maps work in visual mode and operator pending mode ('d\ns' will delete till the end of the section). You can use |n| and |N| Vim normal commands (also in visual mode) to go further.
In visual mode these maps go to end of current section or, if already at the end of section, end of next section.
[title_pattern] is the pattern which will match for the pattern, it should start with '.*' when you want to match somewhere in a middle of the title.
These commands (and maps) use Vim |search()| function or atp-:S command depending on the value of g:atp_mapNn (see atp-:ToggleNn, when g:atp_mapNn=1 the atp-:S command is used). You can set the value of g:atp_mapNn using the command atp-:ToggleNn. If 'wrapscan' is set and g:atp_mapNn=1 the search will wrap around the end of the project (not the end of the current buffer).
You can unmap these keys and use <Plug>GotoNextSubSection, <Plug>GotoNextSection, <Plug>GotoNextChapter, <Plug>GotoNextPart to define new maps.
You can set the leader '<' using g:atp_map_bacward_motion_leader variable.
The {section} argument for :B is one off: part/chapter/section/subsection/subsubsection.
For description of arguments read atp-:NextSection just above.
| Map | Command | Meaning |
<p | :PPart | go to previous part |
<c | :PChap | go to previous chapter |
<s | :PSec | go to previous section |
<S | :PSSec | go to previous subsection |
These commands (and maps) use Vim |search()| function or atp-:S command depending on the value of g:atp_mapNn (see atp-:ToggleNn, when g:atp_mapNng:atp_mapNn=1 the atp-:S command is used). If 'wrapscan' is set and g:atp_mapNn=1 the search will wrap around the beginning of the project (not the beginning of the current buffer).
You can unmap these keys and use <Plug>GotoPreviousSubSection, <Plug>GotoPreviousSection, <Plug>GotoPreviousChapter, <Plug>GotoPreviousPart to define new maps.
Note: If you leave the default value of g:atp_map_forward_motion_leaderr then ATP remaps |<<| to << and also |v_<| to <<. |<| is working and is not touched by ATP. If you have |'timeout'| set then the map is executed faster, if you use |'notimeout'| this workaround it makes these operators work.
Note: If you set g:atp_map_forward_motion_leader="{" then ATP remaps |}| operator to {{
Previous commands where using relative position - goto next/previous section/chapter. The following commands/maps will go to section/chapter as counted from first one.
Note: if you are in a section which has no subsections :SSec and -S will go to next section, the same aplies to other section types.
You can set the leader for maps with g:atp_goto_section_leader.
Read g:atp_toggle_labels below how it handles the prefixes of labels.
Read g:atp_toggle_labels below how it handles the prefixes of labels.
The commands atp-:ToggleEnv and atp-:ChangeEnv changes the prefixes of labels (if there is one, which belongs to g:atp_shortnames_dict) and all ref's (\ref, \eqref and \pageref). You have to turn on this feature by putting g:atp_toggle_labels=1 (by default it is 0). Check if it works for you! If there is a label or reference to which it wants to change it doesn't change labels and issue a Warning Message, thus I believe it should work for every one, but as this changes your file it is turned off by default.)
In project files this is done in all files belonging to the project. Changes are not saved by default (ATP uses |'hidden'| option, so when you use q! or qa! all changes will be lost).
This is an alternative for latexdiff program, but is much faster.
The diff file might not compile well (thus the b:atp_autex is set to 0 by default), this is mainly because the math environments can be break and the output might contain: \( a {= =c\)=} {+ !=c\)+} Other things which are not taken into account are changes of environment names, changes of coordinates in tikz. It would be nice to tell to wdiff to not diff them, but this is not implemented.
After you resolve such conflicts the file should compile nicely
(though I didn't do many tests). After that you can change {=...=} and
{+...+} for something better. For example you can change {= and =} for
\textcolor{red}{=} and {+, +} for \textcolor{blue}{+}. If you resolved
syntactic conflicts in a very nice way you can change whole {=
It works likes ]d but handles multi line definitions.
In the opened window there are several mappings defined:
| <Enter> | open the fd file under the cursor |
| <Tab> | list fonts defined in the fd file (shows the command that you can use in your tex file to use this font) |
| p | preview the fonts defined in the fd file under the cursor, do not shows the latex source. |
| P | preview fonts and show the latex source
(then you can see the errors why the preview was not produced; in many cases there are no encoding files or fonts themselves for which you have to look in ctan archive yourself; or you can just see how to use fonts :) ) |
| q | close the window (actually, delete the buffer using :bd, it will be still in the list if you type ":ls!", so even then you can reload previous searches.) |
In addition to 'p' and 'P' maps there is a :Preview command. Note: the maps 'p' and 'P' work in both normal and visual mode. You can select a part of the text and use this maps or the command :Preview to make one preview file for all the font files.
The same mappings are defined in the window with fd file opened (except <Enter>, <Tab>).
Additionally, read |font-lowlevelcommands| to learn how to use |\usefont|, |\fontsize|, |\selectfont| and other such commands. The 'Latex 2e font selection' by 'LeTeX3 Project Team' might be very useful. It is available on the net (you probably have it in your tex distribution if it is installed with the documentation, if not check the ctan archive).
ATP also has a very nice completion for various font declaration commands, see atp-completion-fontdeclaration.
Hopefully, this will help your documents to become beautiful :)
Without [!] it matches just the name of the fd files, with [!] the pattern {fdFile} matches for full path.
It returns a list of fonts which fd files matches the {fdFile} pattern in [encoding]. You will be asked to chose for which files make a preview, possible answers are:
If there was a command with name 'Status', atp is not overwriting it, it uses ATPStatus name.
Note: if you set g:atp_statusOutDir=0 (the default is 1) then the output directory will be not seen in the statusline.
If g:atp_babel is set to 1 the keymap name is shown in the status line (if you use the atp-status-line).
let g:atp_keymaps | = { | |
| \ 'british' : 'ignore', | 'english' : 'ignore', | |
| \ 'USenglish' : 'ignore', | 'UKenglish' : 'ignore', | |
| \ 'american' : 'ignore', | ||
| \ 'bulgarian' : 'bulgarian-bds', | 'croatian' : 'croatian', | |
| \ 'czech' : 'czech', | 'greek' : 'greek', | |
| \ 'plutonikogreek': 'greek', | 'hebrew' : 'hebrew', | |
| \ 'russian' : 'russian-jcuken', | 'serbian' : 'serbian', | |
| \ 'slovak' : 'slovak', | 'ukrainian' : 'ukrainian-jcuken', | |
| \ 'polish' : 'polish-slash' } |
When the value is
This is useful if you in day to day work use one language, but some times you write a tex file in some other language.
The optional argument [pattern] is used to filter variables names with the given pattern.
TIP: if you are looking for a variable you can use this command to find it.
For the table of contents command and maps read atp-:TOC.
The Table of Contents window is used by both atp-:TOC and atp-:Labelss commands.
In the Table of Contents window there are the following nmaps:
| 'e' | to echo the line from your tex file |
| 'y' or 'c' | to yank the label of the chapter under the cursor to a register, if it exists, |
| 'p' | to paste it directly to your tex file (just after the current cursor position), |
| 's' | it splits the window with your tex source file and sets the current line to the beginning of the chapter/section under the cursor, |
| 'q' | to quit, and finally, |
| <Enter> | to go to the chapter under the cursor and close ToC. |
| <space> | to go to the chapter under the cursor but leave ToC open. |
There are also commands: ':C' and ':P', which do the same as 'c' and 'p'
mappings. They all call the function 'Yank(
You can also delete and paste sections using the Table of Contents window:
These commands are available in table of contents. They act on parts/chapters/sections/subsections/subsubsections.
The other commands do not use registers but an internal stack.
':PasteSection' puts the section just after where current section ends (section under the cursor in the ToC buffer).
Note: If you use bibtex commands to make bibliography ATP finds the line which contains '\bibliography' command. And then searches backward for the first line which is a blank line. The next line is assumed to be the first line of bibliography. Thus to move the last section before bibliography or the bibliography itself its better you put a blank line before bibliography commands. The same applies for bibliographies put in the middle of document (end of a chapter, part, etc.) The end of bibliography is found in the same way as the end of subsubsection. If you use \begin{thebibliography}:\end{thebibliography} there is no such a problem.
If you want to paste a section before the first section, use the line with the file name.
You can use undo. The :Undo command will undo in the buffer under the cursor (it switches to the correct window, using the Vim undo function, and runs :TOC command - so after all your back in ToC.). The ':Undo' command has one argument - the Vim undo command to use, it is one of: 'u/U/g-/g+' (the default is 'u'). They are mapped to 'u','U', 'g-' and 'g+'. (only in the ToC buffer). Note: ':Undo' command doesn't changes the Section Stack.
There is one more level of security: There is a global variable which stores all the deleted sections together with some information about them:
NOTE:
You may want to have a map: >
@article{<label>, \
author = { .... }, <-- bib entry |
title = { .... }, > bib field
journal= " .... ", |
} /
article <-- bib field keyword
author,title,... <-- bib entry label
<label> <-- bib field label
One more function is provided which searches the bib files for bib fields, and for the bib field labels for the latex command \cite{}.
which do what you expect. The arguments should not be quoted and separated by a white spaces (if you want to include a white space use '\ '), for more see |f-args|. If you do not provide any argument then all entries of all bib files will be shown.
Note: {pattern} should be python regular expression not vim regular exression. Unless you set |g:atp_bibsearch|="vim" (the default is "python"). Python regular expressions are quite similar to vim with 'nomagic' set ( grouping with '(' and ')', with separating alternatives with '|'). But there is no vim '\&' in python regexp.
The pattern to highlight matching string is passed to |@/| hence you can use |n| and |N| in the BibSearch buffer. This will only work for {pattern} which is both vim and python regular expression.
See atp-bibflags for the [flag] argument.
The next one shows all bib fields which were written by Joyal and Tirney (and may by somebody else).
Note: Upper pattern is vim pattern lower one is python regexp.
Before the match all the ligature symbols and {:} are removed. For example \`a, \' e, \oa,\ea are substituted with a, e, oa, ea (respectively). Note that the space in \' e is also removed. Each line (without ligatures) of every bib file found in your tex document will be matched against the pattern, for example if the pattern is:
For now, there is no possibility to filter bibliographic entries which both match a pattern in separate lines, i.g. to show all bib entries written by Joyal on 'Descent Theory'.
Before a match, all '{', and '}' are deleted from the line of the bib file. But you will see them in the output (what can be useful for debugging errors in bib files)
Note that in Vim patterns should be quoted using '...' not "...".
Further examples are supplied after the next section atp-bibflags:examples, which describes other functionalities of the BibSearch/BibChoose commands.
The variable 'b:atp_LastBibPattern' stores the last pattern used by bib search.
The first optional argument [flags] chooses what and in which order you want to see the bib entries found (entries are listed in the order they appear in bib file). Flag is a word made of letters. There are three kinds of flags: entry flags which matches against labels of bib entries, like author, title, etc..., and keyword flags: which matches against keywords of bib fields: @article, @book, @techreport, etc... and two special flags 'All' and 'L'. A flag is a word on letters:
a - author e - editor t - title b - booktitle j - journal s - series y - year n - number v - volume p - pages P - Publisher N - Note S - School h - howpublished o - organization u - url H - Homepage any other letter - do not show anything but the first line of bib entry @a - article /@article/ @b - book or booklet /@book,@booklet/ @B - Booklet /@booklet/ @c - incollection /@incollection,@inbook/ @p - proceedings, inproceedings, conference /@proceedings,@inproceedings,@conference/ @m - misc /@misc/ @M - Manual /@manual/ @t - master or PhD thesis /@masterthesis,@phdthesis/ @T - Techreport /@techreport/ @u - unpublished /@unpublished/ All - all flags (see atp-bibflags:all) L - last flags (see atp-bibflags:last)
Examples:
Flags '@.' are filtered out, if one does not belong to the one above then it is deleted. You can see which flags are defined using ShowOptions function/command (they are listed as Available KeyWordFlags).
The default flag is stored in the global variable g:defaultbibflags and is equal to 'tabejsyu'. This means that the output for each bib field found will include the
title author booktitle editor journal series yearif title,author,... are specified in the bibliography for the given position. If there are many position which match you can set flags to be as simple as possible to include more lines on the screen. For example 'tabe' is quite reasonable (note that all bib entries are matched separately, i.e. if a bib field has both 'title' and 'booktitle' bib entries it will give you both of them.
If you just want to list just the lines with bib fields keywords: @article{, @book{, etc. supply a flag which do not belongs to 'g:defaultallbibflags', for example 'X', or 'X@a'
You can also specify flags with '+', for example:
The flags='All' is a synonym of flag=g:defaultallbibflags which by default is equal to'tabejfsvnyPNSohiuHcp' i.e. all flags in this order. If you add your own flag you should change this global variable. You can add to this flag any flag which contains '@' (see atp-bibflags) by the plus operator, i.e. All+@a@b or +@aAll will give the same result.
The variable 'b:atp_LastBibFlags' stores the recently used flags. The flag 'L' sets the flags for this search to the value of 'b:atp_LastBibFlags'. You can write '+L@a', '+L@a', 'L@a' or '@aL' but not '+@La', if you want to add some flags to previous searches. Next time the flag 'L' will change the meaning (i.e. it is really the last time not earlier :) However, there is no '-' :( '-@aL' could be helpful.
The variable 'b:atp_LastBibFlags' is not changed when you use the 'All' flag.
You can add your own flags but not keyword flags (i.e. @a,@b,...). Just add an entry to the dictionary g:bibflagsdict. (:ShowOptions v to see its current value), For example
Some examples:
This command is only available in the window with BibSearch results and allows to copy a bib entry key to a register or directly to the last opened buffer (after the cursor position). It is mapped to 'c' and 'y'. You will be asked to give the number of bib entry to yank:
<bib entry number><register name><Enter> - to copy it to a register <bib entry number><Enter> - to paste it to 'tex' file <Enter> - to skip the choiceWhen you paste the bib entry key the bib search window will close. For example:
The same you will obtain using the nmaps y or c.
This commands and maps are only in the BibSearch buffer.
The colours of the output are set by the syntax file 'syntax/bibsearch_atp.Vim'. All groups except one are the same as in the syntax file for bib files ('syntax/bib.Vim' in your $VIMRUNTIME directory). Their names are 'bibsearchEntryKw' instead 'bibEntryKw'. The one that is differently defined 'bibsearchComment'. Which is changed in that way to highlight the bib file names. One additional highlight group is: 'bibsearchInfo'. It highlights the number of entry and its line number in the bib file. By default all bibsearch groups are linked to the corresponding bib group, the bibsearchInfo group is not set.
In a colour file (~/.Vim/color/*.Vim) you can use these groups to set colours. See |highlight| or just read a colour file. For example, this is a nice set of colours for dark background
Please do not hesitate to report any bug to the mailing list.
The algorithm will work only if all kind of bib entries of your bib file are included in the list g:bibentries. However, changing just this variable is not enough. In that case the search engine (function s:search) will produce correct output, but the function which displays found entries, will not know how to work with the new entries. One would have to add an entry to the dictionary 'g:bibflagsdict'. If it is the case, please let me know on the mailing list.
As you can see entries of the type '@string' which can be used in bib files are not supported (i.e. there is no function which substitutes the variables defined in @string to their values), but it is doable. @string{ Name = Value }
The completion is by default mapped to
There are two completion algorithm: expert mode and non expert mode: the keyword for completion in expert mode must match at the beginning, in non expert mode any where. Also in expert mode the list of possible completions is smaller (for example there is no '\lneqq', there is only '\lneq').
Note: Non expert mode doesn't check if you are editing math (see g:atp_MathOpened), and is useful when you want to complete a non-math command inside mathematics.
If you prefer to not map <Tab> key then you can define g:atp_no_tab_map=1 in your vimrc file or atprc file |atprc|. Note that Vim can add/remove tabshift width from the beginning of line in other ways: in normal mode with |>>| and |<<|, in insert mode: |i_CTRL-T|, |i_CTRL-D| and in visual mode with |>| and |<|. Also you can use atp-g> and atp-g<. The alignment of tabular and other environments can be done with atp-:TexAlign command.
You can switch off/on completion modes adjusting the variable 'g:atp_completion_active_modes', all names of completion modes are stored in the variable 'g:atp_tab_completion_modes'.
If g:atp_local_completion is set to non zero value, then input files will be scanned for \def, \newcommand, \newnevironment and \newtheorem commands and they will be used for completion (with atp-:LocalCommands). If its value is 1 then this will be done during first completion, if it is set to 2 then this will be done at start up. The default value is 2 when vim has |+python| feature otherwise it is 1. With |+python| this is done at every time you use the Tab completion.
NOTE: if you press <Tab> but then you changed your mind, the completion pop-up menu allows to cancel completion: press ctrl+p (i.e. go up - some times more than once) and then press <space>.
Note: Completion checks the preamble for definitions of LaTeX packages. If a supported package is present (for example: tikz) then the completion will contain additional commands. If you add a package or a class you should unlet corresponding variable: g:atp_LatexPackages and g:atp_LatexClasses.
It is a command to toggle the tab map off/on: :ToggleTab, it is also mapped to `<Tab>.
Note: see atp-Tab-note.
if g:atp_check_if_math_mode = 1 then the pull of commands contains math commands only if there you are inside a math environment. This works perfectly if you switch from $:$ and $$:$$ to their equivalent (and more up-to-date) \(:\) and \[:\]. The list of math environment in which ATP will think you are editing a math mode is stored in the variable: 'g:atp_math_modes'. Its entries are two element list of patterns which matches the beginning and end of a math mode. The '0' entry have to provide the beginning and end pattern of in line math '\(:\)', the second for displayed math '\[:\]'. Its default value is given below.
If you add a package (like tikz or amsmath, or amssymb) then the set of completions will contain extra commands/environment names defined in these packages Because some classes calls amsmath package silently setting the variable 'g:atp_amsmath=1' will ensure that you will get completions for these commands. The algorithm checks if you have this package declared or if you use some of the standard ams class (actually checks if the document class name matches '^ams').
If you do not want math commands completions at all define ':let g:atp_no_math_command_completion=1' (you can put it in your |vimrc| or atprc file, or define while writing, both will work, so you can switch off the math completions temporarily).
The label command completes in a special way: for example in a line like:
If g:atp_amsmath=1 or you use one of ams classes, or the package amsmath is found by ATP ams math commands and environment names will be added to the list of completions.
By default the first time you are completing an environment name or a command a list of locally defined environments and commands is made (it takes a few seconds). If you do not want to completions for them define "let g:atp_local_completion=0", if g:atp_local_completion=2" then the search for local definitions and commands will be done on startup (after version 8.4 for this you have to switch off abbreviations by setting g:atp_noabbreviations to 1 - but anyway it is not time consuming because these variables are loaded from atp-ProjectScript).
If you added a command or an environment the command :LocalCommands! will update the list of local definitions. With bang "!" it update the list of input files b:ListOfFiles in which the search is done. The output is stored in three variables:
Note: the python version searches for commands, environments, ... defined in the begining of line (with possible white spaces).
Note: the python version of LocalCommands will save the current buffer, without saving project script and with 'nowritebackup' and 'nobackup' set.
There is an extended support for tikz picture environment both inline \tikz{:} and displayed: \begin{tikzpicture} \end{tikzpicture}. The completion works for both commands and keywords. The pull of them is enlarged if you add tikz libraries. Normal commands are added if you are inside {:}.
For label completion puts short names, for ref and eqref commands the completions are the labels found in all files associated to the main file (the plugin searches the input and include files for them). The same for cite: which searches also in bib files defined in the main file.
In the popup menu the first column show the label name, second column contains the first letter of the counter name used: e for equation, t for theorem, s for section, c for chapter, I for Item, etc. - these are the most common things you will see. The third column contains the value of the counter. It is put in brackets () if it comes from equation counter.
There is also omni completion (CTRL-X CTRL-O, see |i_CTRL-X_CTRL-O|) for \cite command. Check it out, as it is very nice (especially in gvim!) and very fast.
For both completion and omni completion for the cite command, the text after \cite{ [ or after a comma after \cite{ ] is treated as a regular expression. Thus you can write:
BibTeX omni completion is triggered by '\cite{', '\citep{' or '\citet{'. For example, assume you have in your .bib files an entry looking like:
@book { knuth1981,
author = "Donald E. Knuth",
title = "Seminumerical Algorithms",
publisher = "Addison-Wesley",
year = "1981" }
Then, try:
You can also use Vim patterns after '\cite{'.
Tab Completion for labels (|atp-completion|) allows to specify the number of the counter, e.g.
For this two work the aux file must be present. As for now the aux file, if it is not present, is not made.
This is working with the main document classes: article, book, review, amsart, amsbook, memoir. If for some class it is not working thanks for reporting me (it's enough to email me just the document class).
Closing of brackets {:},{:},[:],(:) (also closes math modes \(:\) and \[:\]). Relevant variables are: g:atp_bracket_dict a dictionary of brackets by default it consists of pairs '(' : ')', '{' : '}', '[' : ']'. There is a second dictionary g:atp_sizes_of_brackets which contains all the sizes of brackets in latex plus a pair '\' : '\', for closing the math modes: \(:\), \[:\] and the brackets \{:\}.
Completes after '\begin{' and '\end{'. For example
'\begin{cen
The environments opened in tex definitions ('\def', '\newcommand', '\renewcommand') will not be closed unless the current cursor position is in that line (sometimes one might want to have a definition which only opens an environment).
If you type \begin{envname}
See g:atp_amsmath.
(the <Tab> indicates in which position the <Tab> can be pressed to get the described behaviour).
\begin{theorem}
\begin{enumerate}
\item .....
\item .....
\begin{minipage}
......
\end{minipage}
......
......<Tab>
XXXXXX
......
\end{theorem}
Usually the closing comes in the next line,
unless we are inside an environment which is opened
after the non closed environment:
\begin{theorem}
\begin{enumerate}
\item .....
\item .....
\begin{minipage}<Tab>
......<Tab>
\end{minipage}<Tab>
XXXXXX
......
......
......
\end{theorem}
Then the closing will be put just after the last
opened environment closes, or
\begin{theorem}
\begin{enumerate}
\item .....
\item .....
\begin{minipage}
......
\end{minipage}
......
......
......
XXXXXX
\end{theorem}<Tab>
....<Tab>
If we are outside the theorem environment,
'\end{enumerate}' will be placed just above
'\end{theorem}', and
\begin{theorem}[Joyal\&Tirney]\label{thm:jt}
\begin{enumerate}
\item .....
\item .....
\begin{minipage}
......
......
XXXXXX
\end{enumerate}<Tab>
\end{theorem}<Tab>
will put \end{minipage} just above
\begin{enumerate}. Furthermore, if:
\begin{theorem}
\begin{enumerate}\label{enu:1}
\item .....
\item .....
\begin{minipage}
......
\begin{itemize}
......
\end{itemize}
......
......
XXXXXX
\end{enumerate}<Tab>
\end{theorem}<Tab>
'\end{minipage}' will be put just above
'\end{enumerate}'. Furthermore,
\begin{theorem}[...]\label{...} Let \(C\) be a ....
......
......<Tab> XXXXX
That is, if you like to write \begin{}:\end{} in the beginning
and end of a line this will be preserved. However, there is no
support for nested environments then!There is tab completion for insert mode abbreviation names (use <ctrl-y> to choose one from the list and then type <space>, just typing <space> should also work).
This is completion for the commands
\usefont{<encoding>}{<font_familly>}{<font_series>}{<font_shape>},
\fontencoding{<encoding>},
\fontfamily{<font_family>},
\fontseries{<font_series>},
\fontshape{<font_shape>},
\DeclareFixedFont{<cmd>}{<encoding>}{<font_familly>}{<font_series>}{<font_shape>}{<size>}
It first splits the line and take a part between the commands
\selectfont (if there is not \selectfont command this step is
omitted).
Then if the <encoding> is declared the font families for the completion will only come from this <encoding>.
If <font_family> is defined, <font_series> and <font_shape> come from the particular font definition file (the declared encoding is used if not the value of g:atp_font_encoding is used).
If <font_family> and <font_series> are defined then the <font_shape> for this font (in the above encoding) is found.
Completion for the command '\bibliographystyle{'. Finds all "bst" files available in your tex distribution.
Completion for the command '\documentclass'. Returns list of all classes available in your distribution.
These are all variables which can help to customise the completion: (if the value is given it is the default, if it is not means it is too long to put it here).
The above variable specifies how long should atp plugin search for closed/unclosed environments:
the first value - search for \(:\) [ in line math ]
the second - search for \[:\] [ displayed math ]
the third - search for \begin{:\end{
the fourth - for environments defined in the variable
You can also put "-1" as the values of g:atp_completion_limits, then the search forward/backward will last till first/last line. However, this makes it run slower.
If some of your environments are very long put their names in this list. Do not forget that is environment <env> is long and is put inside environment <center> then <center> is also long!
However, this will not close long environments (for that you have to change the third argument of g:atp_completion_limits !). This just prevents closing environments which are closed and to long to see that.
g:atp_completion_modes = [ \ 'commands', 'inline_math', \ 'displayed_math', 'package_names', \ 'tikz_libraries', 'environment_names', \ 'close_environments' ,'labels', \ 'bibitems', 'input_files', \ 'bibfiles', 'bibstyles', \ 'documentclass' ]
This is the list of completion modes.
This is the list of completion modes which are active, by default all modes are active. Remove a value from this list to make it inactive (You can use remove() command, see ':h remove()').
If the length of completion list for Tab Completion is longer than this value, entries will be sorted alphabetically, else they are provided in, I hope, useful order. If set to 0 the list will not be sorted (if set to 1 it will be always sorted).
It is used to define
It is used as a separator in: \label{
The following variabe if set to one then completion for \label command will put short name of the environment where it stand. It uses the dictionary g:atp_shortname_dict to get the short name.
These variables are lists which stores LaTeX commands used in completion.
The two last are lists of commands will be add only in the non expert mode (atp-completion-non-expert-mode).
do not complete commands less than 4 characters (not counting the leading '\' if present). If 0 then complete all the defined commands. This only works in the expert mode.
let g:atp_MathZones = [ \ 'texMathZoneV', 'texMathZoneW', \ 'texMathZoneX', 'texMathZoneY', \ 'texMathZoneA', 'texMathZoneAS', \ 'texMathZoneB', 'texMathZoneBS', \ 'texMathZoneC', 'texMathZoneCS', \ 'texMathZoneD', 'texMathZoneDS', \ 'texMathZoneE', 'texMathZoneES', \ 'texMathZoneF', 'texMathZoneFS', \ 'texMathZoneG', 'texMathZoneGS', \ 'texMathZoneH', 'texMathZoneHS', \ 'texMathZoneI', 'texMathZoneIS', \ 'texMathZoneJ', 'texMathZoneJS', \ 'texMathZoneK', 'texMathZoneKS', \ 'texMathZoneL', 'texMathZoneLS', \ 'texMathZoneT' ]
the default value in plaintex files is
These are zones recognized by tab completion as mathematical ones (see g:atp_MathOpened).
List of environments which is not closed by <tab> completion. (The document environment in longer documents can be not seen by the algorithm as closed, because it searches only in a part of the text, see g:atp_completion_limits variable above).
g:atp_sizes_of_brackets = { \ '\left' : '\right', '\bigl' : '\bigr', \ '\Bigl' : '\Bigr', '\biggl': '\biggr' , \ '\Biggl' : '\Biggr', '\' : '\' }
The variables:
stores list of packages and classes in your tex distribution. They are restored when you exit Vim from the global project script (see atp-ProjectScript_global). They are used for completion of the LaTeX commands \usepackage and \documentclass.
If you reinstall, add or remove tex classes/packages from your tex distribution it is enough to unlet these variables. ATP will find new values when it will need them for the first time.
by David Munger (LatexBox plugin)
Completion is achieved through omni completion |compl-omni|, with default bindings <CTRL-X><CTRL-O>. There are four types of completion:
Command completion is triggered by the '\' character. For example,
Associated settings:
atp-g:LatexBox_completion_commands
atp-g:LatexBox_completion_close_braces
Environment completion is triggered by '\begin{'. For example, >
Completion of '\end{' automatically closes the last open environment.
Associated settings:
atp-g:LatexBox_completion_environments
atp-g:LatexBox_completion_close_braces
Label completion is triggered by '\ref{' or '\eqref{'. For example, >
It matches:
1. Labels:
Associated settings:
atp-g:LatexBox_ref_pattern
atp-g:LatexBox_completion_close_braces
BibTeX completion is triggered by '\cite{', '\citep{' or '\citet{'. For example, assume you have in your .bib files an entry looking like:
@book { knuth1981,
author = "Donald E. Knuth",
title = "Seminumerical Algorithms",
publisher = "Addison-Wesley",
year = "1981" }
Then, try:
You can also use regular expressions (or Vim patterns) after '\cite{'.
Associated settings:
Patterns to match \cite and \ref commands for BibTeX and label completion. Must include the trailing '{'. To match all commands that contain 'cite' (case insensitive), use:
If nonzero, spaces act as wildcards ('.*') in completion. For example, if nonzero, >
If nonzero, omni completion will add closing brackets where relevant. For example, if nonzero,
Static completion lists for environments atp-omnicompletion-environments and commands atp-omnicompletion-commands.
There are several options you can set, and they might be set in your Vimrc file. The default values are given below (except the completion setup and bibtex documented above). Note: not all variables are listed below.
All the values of important variables with their values can be shown (grepped) by atp-:ShowOptions command.
$HOME/.atprc.vim (only on Unix and GNU/Linux) or
$VIMRUNTIME/ftplugin/ATP_files/atprc.vim
Tip: If you want to see (almost) all the variables, type ':let g:atp_<CTRL_D>', and ':let b:atp_<CTRL_D>'.
All buffer variables (see |b:var|), i.e. these which name begins with "b:", should be set in your |vimrc| or atprc file. If you want to use your vimrc file then the best way to do that is by using an autocommand:
You can set it to latex, tex, luatex, and so on and possibly to lilypond as well.
There is a command to set this variable with nice completion, see atp-:Compiler.
Note: the gramar for this variable: it should be a semicolon separated list of variables and values, i.e. 'variable_1=value_1;variable_2=value_2'
This variable sets the bibtex backend. There are other programs which might be used, for example biber and pybib (not tested with ATP).
The default value will be "biber" if the preamule contains \usepackge[backend=biber]{biblatex}. If it is set to "biber" ATP will adjust g:atp_keep variable (add run.xml, bcf extensions) when you use atp-:TEX, atp-:Bibtex, or atp-:MakeLatex commands.
If you set this variable to './' (or '.') and change the current working directory for example to /tmp (:cd /tmp) then the latex output will be placed in /tmp, i.e. it will move with with cd. However, the default value of b:atp_OutDir is not affected by :cd command.
White spaces and other characters should not be escaped. It will be quoted in '...' using the |shellescape()| function.
You can see the current output directory in the status (it is in the short notation) to see it whole type:
If in your environment the variable $TEXMFOUTDIR is set the value of b:atp_OutDir will be set to its value.
See b:atp_MainFile.
Note: the standard tex syntax file defines other zones: for example for align and equation environments (and many others) but some how they are not accessible using synstack() function.
This feature can be turned off setting variable:
If you use program b:atp_Viewer then you can use the variable b:atp_{b:atp_Viewer}Options to set the options (it is a vim list), for example if b:atp_Viewer="xpdf" then you might use:
These are lists in which every viewer switch and its value should be placed as element (seprate!). See examples below.
For example, if you want to have different look of one document you can set it to "-bg gray20". Some examples:
It is equal to the name of the source file. You do not need escape spaces in the name (shellescape() function is used before it is send to the shell).
If you use "biber" ATP will add "run.xml" and "bcf".
You can change this variable by the command:
let g:atp_CompilersDict = { \ "pdflatex": ".pdf", "pdftex" : ".pdf", \ "xetex" : ".pdf", "latex" : ".dvi", \ "tex" : ".dvi", "elatex" : ".dvi", \ "etex" : ".dvi", "luatex" : ".pdf"}
in your |vimrc| or atprc file if you do not want the status line provided by this plugin. (See atp-:Status).
There are other tools to make editing project files more easy. There is search function: atp-:S which works better than the Vim |:ijump| command, which cannot go above the current file in the tree of input files /but |:ijump| is much faster/.
If you run into problems with atp-:S you can set this variable to 0 and use atp-:InputFiles to regenerate the variables - they will now store the full path (the other way around also works).
The default value of g:atp_mapNnis 0.
The variable g:atp_mapNn should be always set as follows (in atprc or |vimrc| file):
if !exists("g:atp_mapNn")
let g:atp_mapNn = 1
endif
Then the value will be preserved when atp opens new buffer when using
atp-:S command. If you want to have project specific
setting use atp-ProjectScript.Another good tip for LaTeX project files is to set b:atp_TexFlavor variable to 'tex' (in your |vimrc| or atprc file). This will prevent from situations that Vim recognizes input file as a plain TeX while it is an input file into a LaTeX project. Another way is add options to 'viewoptions' (see |'viewoptions'|). And set mkview and loadview via autocommands
The file: b:atp_MainFile . ".project.vim", in the same directory as b:atp_MainFile stores values of local variables saved before Vim leaved a buffer (it is very similar to |View|). Also values of some global variables are stored in a seprate file (oine for all tex files).
Loading procedure searches for files which ends with .project.vim. There might be many such files in one directory. The file is used which contains the current buffer in the list b:ListOfFiles. If none of the project scripts was containing the current buffer name in b:ListOfFiles then new project script will be written for the current buffer. Before writing the project script file if b:ListOfFiles doesn't exists it will be generated and written.
If the project script is stored locally the it is easier to include it in a revision system (bzr, svn, etc.) and share it with collaborators.
The global project script (which, by default, stores global variables: g:atp_LatexPackages, g:atp_LatexClasses, g:atp_Library) is now '~/.vim/ftplugin/ATP_files/common_var.vim'.
atprc file is executed before project script file (with local variables) and common_var.vim (with global variables) files are sourced. Thus this files will override the settings in |vimrc| and atprc files.
Local and global variables are supported. The local variables which are cached in this way are listed in
let g:atp_ProjectLocalVariables = [ \ "b:atp_MainFile", "g:atp_mapNn", "b:atp_autex", \ "b:atp_TexCompiler", "b:atp_TexOptions", "b:atp_TexFlavor", \ "b:atp_OutDir", "b:atp_auruns", "b:atp_ReloadOnErr", \ "b:atp_OpenViewer", "b:atp_XpdfServer", "b:atp_ProjectDir", \ "b:atp_Viewer", "b:TreeOfFiles", "b:ListOfFiles", \ "b:TypeDict", "b:LevelDict", "b:atp_BibCompiler", \ "b:atp_StarEnvDefault", "b:atp_StarMathEnvDefault", \ "b:atp_updatetime_insert", "b:atp_updatetime_normal" \ ]
Each file has separate project scrips which stores the values Ef these variables. It's name is stored in b:atp_ProjectScriptFile.
There is also file for variables for all projects. It stores values of global variables (by default it is "ftplugin/ATP_files/common_var.vim". The global variables that are written in this file are given in Vim list:
let g:atp_ProjectGlobalVariables = [ \ 'g:atp_LatexPackages', \ 'g:atp_LatexClasses', \ 'g:atp_Library' ]
or you can add to the project scrpit:if expand("%:p") ==let b:atp_ProjectScript = 0 endif
The command ':ToggleProjectScript [on/off]' turns on/off the feature for this buffer (it sets b:atp_ProjectScript). When no argument is given it will toggle the value. With bang it also sets the global variable g:atp_ProjectScript. b:atp_ProjectScript is by default in the g:atp_ProjectLocalVariables so it will be restored afterwards. |b:atp_ProjectScript| if defined overrides the value of global variable |g:atp_ProjectScript|. So you can set in your atp file g:atp_ProjectScript = 0 and for some files using the if-construction:
will turn on the feature only for myfile.tex. Something more elaborate would be to set b:atp_ProjectScript only for files with modification time less than two days for example.let g:atp_ProjectScript = 0 if expand("%:t") == "myfile.tex" let b:atp_ProjectScript = 1 endif
Note: If you delete the project script for the current buffer it will be written after exiting Vim, unless you turn off the project feature.
The project script is disabled for files which full path matches "texmf". With the optional bang atp-:LoadProjectScript loads the common project script also for them. atp-:WriteProjectScript command will write the project script disregarding if the file is under texmf directory or not.
Note: If you use this feature, you might need to use the commands: atp-:LocalCommands and atp-:InputFiles which will update b:atp_LocalCommands, b:atp_LocalColors, b:atp_LocalEnvironments and b:TreeOfFiles, b:ListOfFiles, b:TypeDict and b:LevelDict. Use these commands with a bang "!". The second set of variables is also updated by atp-:S (also with "!") and and atp-:GotoFile (with "!" as well).
Note: Also when you add a package to tex you should remove the common project scrip, so that the new packages will be added to completion list.
This is command does the same job as |/| but is recursive in the tree of files (so it is useful only in project files). The syntax of this command is similar to |:vimgrep|.
This works similarly to |:ijump|. But also goes back to the root file (b:atp_MainFile).
It sets the alternate file to the buffer from which the search begun. Note that this means that if nothing was found the alternate file before search will be lost.
The {pattern} is any Vim pattern as described in |pattern| (it was only tested with 'magic' set on).
The supported [flags] are 'bcewW'. Their meaning is the same as flags for |search()| function.
You can enclose the pattern with any non-ID character (see |'isident'|) instead of /, as far as it does not appear in the {pattern}. Examples:
Note that the function might be slow when the project files where not yet opened.
There is a function to check where the input file is on the hard drive if the name in the input command doesn't include the full path. It asks kpsewhich which directories to search, filters out directories which are not under '/home' (I assume that there is your local texmf tree) and also directories which name contains one of the two keywords 'texlive' and 'kpsewhich'. This makes the searching faster.
Furthermore, the command is designed so that it can find all patterns '\\input' (and thus easily find next/previous input file). You can use:
and you can use |n| and |N| Vim normal commands. Note that it if you go backward, then it means that it will find the most deep line, e.g.:
file.tex
----
----
\input{file.1} ----> -------
-------
\input{file.1.1}
-------
----X
':S /\\input/ b' in the X position fill find \input{file.1.1} assuming
file.1.1.tex doesn't includes any other file.
The pattern can be '\\input'. Then it goes recursively to the first input line.
Now it also doesn't search inside commented input files. There two commands:
Lots of mappings which are given here uses #. This is a convenient map on British keyboards, but not in the US layout, you can change them for '`' or some other key that it is not used in Vim (there are not many of them though). The most commonly used latex-suite plugin uses similar set of mappings (but there might be some differences). The easy way to change imap leaders is by using the variables:
Note: the best way to list mappings with leader '#' in insert mode is to use
You can list imaps with atp-:HelpMathIMaps and atp-:HelpEnvIMaps but the best way is to use |imap| directly.
All other mappings (|map|, |vmap|, |nmap|, ...) are using |
Maps are using the
Note: in all mappings '\' is set to your |
Note: The list of commands might not be complete.
Note: There are many internal maps defined |<Plug>|, they are not documented, but you can easily find them (you can start with ftplugin/ATP_files/mappings.vim, where they are used in rhs of maps or you can search for them inside the scripts).
Note: you might like to use |'notimeout'| and |'nottimeout'| settings. However, they require that there are no maps such that no lhs is a subset ot the another, i.e. like "ab" and "abc". With the default settings it is shouldn't be a problem.
imap <Ctrl-j>, imap <Ctrl-k> - these are two motions (based on syntax) which help to navigate thought brackets (but not only) in insert mode.
- as above but in normal mode.
These motions emulate the behaviour of latex-suite place holder system <++>, without putting the placeholder into tex file.
Without any argument it will open "g:atp_TeXdocDefault", by default it is eqaul to "-a lshort", i.e. "The not so short introduction to LaTeX 2e" by Tobias Oetiker. You can change the default for something that you use more often, for example you can set it to "-a faq", i.e. 'The UK TeX FAQ' (or even to "-a lshort faq" if you want them both :).
Comment/Uncomment lines (both in |Normal| and |Visual| modes).
Comment leader can be set with the variable g:atp_CommentLeader (by default it is '% '). If you do not want this maps or you want to remap them to something else you can set g:atp_MapCommentLines=0 in your |vimrc| or atprc file and use <Plug>CommentLines, <Plug>UnCommentLines (these are normal maps), for example:
<F2> acts as 'Q/i' (i.e. enters insert mode). If you want Q/ and Q? enter insert mode as well you can set: >
imap ##rm | \textrm{}<Left> |
imap ##it | \textit{}<Left> |
imap ##sl | \textsl{}<Left> |
imap ##sf | \textsf{}<Left> |
imap ##bf | \textbf{}<Left> |
imap ##mit | \mathit{}<Left> |
imap ##mrm | \mathrm{}<Left> |
imap ##msf | \mathsf{}<Left> |
imap ##mbf | \mathbf{}<Left> |
Note: You can list this mappings using the command |atp-:HelpMathIMaps|. You might not see them using |:imap| unless the last cursor position in insert mode was inside mathematics.
Note: If you do not want imaps for greek letters you can set g:atp_ima_define_greek_letters = 0
imap #a | \alpha |
imap #b | \beta |
imap #c | \chi |
imap #d | \delta |
imap #e | \epsilon |
imap #f | \phi |
imap #y | \psi |
imap #g | \gamma |
imap #h | \eta |
imap #k | \kappa |
imap #l | \lambda |
imap #i | \iota |
imap #m | \mu |
imap #n | \nu |
imap #p | \pi |
imap #o | \theta |
imap #r | \rho |
imap #s | \sigma |
imap #t | \tau |
imap #u | \upsilon |
imap #vs | \varsigma |
imap #vo | \vartheta |
imap #w | \omega |
imap #x | \xi |
imap #z | \zeta |
Not all upper Greek letters are in LaTeX:
imap #D | \Delta |
imap #Y | \Psi |
imap #F | \Phi |
imap #G | \Gamma |
imap #L | \Lambda |
imap #M | \Mu |
imap #P | \Pi |
imap #O | \Theta |
imap #S | \Sigma |
imap #T | \Tau |
imap #U | \Upsilon |
imap #V | \Varsigma |
imap #W | \Omega |
imap #Z | \mathrm{Z} |
Note: you can list this mappings using the command atp-:HelpEnvIMaps.
Note: This can be effectivly set only in atprc or |vimrc| files.
These maps are fully customizable: both sides: the lhs and rhs side ! Here is how you can set the rhs:
This variables defines environment names put it the following environment imaps.
imap ]b | ]beg | \begin{}<Left> |
imap ]e | ]end | \end{}<Left> |
imap ]C | ]cen | \begin{center}<Cr>\end{center}<Esc>O |
imap ]d | ]def | \begin{definition}<Cr>\end{definition}<Esc>O |
imap ]t | ]the | \begin{theorem}<Cr>\end{theorem}<Esc>O |
imap ]P | ]Pro | \begin{proposition}<Cr>\end{proposition}<Esc>O |
imap ]l | ]lem | \begin{lemma}<Cr>\end{lemma}<Esc>O |
imap ]r | ]rem | \begin{remark}<Cr>\end{remark}<Esc>O |
imap ]c | ]cor | \begin{corollary}<Cr>\end{corollary}<Esc>O |
imap ]p | ]pro | \begin{proof}<Cr>\end{proof}<Esc>O |
imap ]x | ]exa | \begin{example}<Cr>\end{example}<Esc>O |
imap ]n | ]not | \begin{note}<Cr>\end{note}<Esc>O |
imap ]E | ]enu | \begin{enumerate}<Cr>\end{enumerate}<Esc>O |
imap ]I | ]ite | \begin{itemize}<Cr>\end{itemize}<Esc>O |
imap ]i | ]I | \item |
This map has more features: if the preceding line is of the form:
imap ]a |
]ali | \begin{align}<Cr>\end{align}<Esc>O |
imap ]q |
]equ | \begin{equation}<Cr>\end{equation}<Esc>O |
imap ]l |
]lem | \begin{flushleft}<Cr>\end{flushleft}<Esc>O |
imap ]R |
]rig | \begin{flushright}<Cr>\end{flushright}<Esc>O |
imap ]T |
]tik | \begin{center}<CR>\begin{tikzpicture}<CR><CR>\end{tikzpicture}<CR>\end{center}<Up><Up> |
imap ]f |
]fra | \begin{frame}<Cr>\end{frame}<Esc>O |
imap ]let |
\begin{letter}{<cursor>}
\opening{g:atp_letter_opening}
\closing{g:atp_letter_closing}
\end{letter} |
Next three sets of imaps: ">atp-imap-math, atp-imap-math-misc and atp-imap-diacritics define imaps with overlaping keys (lhs), but note that first two are defined only in math environment, while the last only in non math environment. In this way `' in math environment will produce \acute{} while in non math \'{}.
These imaps are defined in g:atp_imap_math variable (except ]m and ]M imaps). They might be turned off usgin atp-:ToggleIMaps commands or g:atp_imap_define_math variable (be setting it to 0, works on the fly).
For convienience, there are:
imap ~~ | \tilde{} |
imap ~^ | \hat{} [^^ is used for ^{}] |
imap == | &= | ||
imap =~ | \cong | ||
imap ~~ | \approx | ||
imap ++ | \sum | ||
imap o+ | \oplus | ||
imap O+ | \bigoplus | ||
imap o- | \ominus | ||
imap o. | \odot | ||
imap O. | \bigodot | ||
imap o* | \otimes | ||
imap O* | \bigotimes | ||
imap s+ | \cup | [ set +] | /set = set theoretic/ |
imap s- | \setminus | [ set -] | |
imap S+ | \bigcup | [big set +] | |
imap s* | \cap | [ set *] | |
imap S* | \bigcap | [big set *] | |
imap c* | \prod | [ cat *] | /cat = categorical/ |
imap c+ | \coprod | [ cat +] | |
imap <= | \leq | ||
imap >= | \geq | ||
imap t< | \triangleleft | ||
imap t> | \triangleright | ||
imap s< | \subseteq | [ set <] | |
imap s> | \supseteq | [ set >] |
These imaps are defined in g:atp_imap_math variable (except ]m and ]M imaps). They might be turned off usgin atp-:ToggleIMaps commands or by setting the variable g:atp_imap_define_math to 0 (this should also work on the fly).
These are very useful mappings for typing mathematics.
Some of the ideas were taken from TeX_9 by Elias Toivanen and also AuTeX by
Carl Mueller.
Note: you might not see them using |:imap| unless the last cursor position
in insert mode was inside mathematics.
imap #\ | \setminus |
imap #/ | \frac{}{} |
imap #& | \wedge |
imap #ve | \vee |
imap #V | \Vee |
imap #N | \Nabla |
imap #= | \equiv |
imap `8 | \infty [the default '#' is not working, ` is used intead, but only if g:atp_imap_first_leader='#'] |
imap `6 | \partial [as above, you can also use \p<Tab>] |
imap #@ | \circ |
imap #= | \equiv |
imap #* | \bigcap |
imap #+ | \bigcup |
imap #\ | \backslash |
imap #> | \geq |
imap #< | \leq |
imap #. | \dot [#.s will put \dots] |
These imaps are defined in g:atp_imap_math_misc variable. They might be turned off usgin atp-:ToggleIMaps commands or g:atp_imap_define_math_misc variable.
imap `` | \grave{} |
imap `' | \acute{} |
imap `> | \vec{} |
imap `. | \dot{} |
imap `v | \check{} |
imap `_ | \bar{} |
imap `~ | \tilde{} [if g:atp_imap_wide is nonempty it is \widetilde{}] |
imap `^ | \hat{} [as above] |
These maps are defined in g:atp_imap_diacritics variable.They might be turned off usgin atp-:ToggleIMaps commands or g:atp_imap_define_diacritics variable (be setting it to 0, works on the fly).
imap `' | \'{} |
imap `" | \"{} |
imap `^ | \^{} |
imap `v | \v{} |
imap `b | \b{} |
imap `d | \d{} |
imap `` | \`{} |
imap `H | \H{} |
imap `~ | \~{} |
imap `. | \.{} |
imap `c | \c{} |
imap `t | \t{} |
This are available maps in the log file, when it was opened with atp-:OpenLog command
]e, | [e | - go to next/previous error message in log file |
]w, | [w | - go to next/previous warning message in log file |
]c, | [c | - go to next/previous citation warning message in log file |
]r, | [r | - go to next/previous reference warning message in log file |
]i, | [i | - go to next/previous info message in log file |
]f, | [f | - go to next/previous font info message in log file |
]p, | [p | - go to next/previous font package message in log file |
]P, | [P | - go to next/previous page in log file |
% | - searchpair for (:). |
The following abbreviations are defined:
+- for \pm +| for \dagger ++ for \ddager =<env_name>= for environments.You can use atp-completion (<Tab>) for abbreviation names, see atp-completion-abbreviations.
Locally defined environments are also supported (the one defined in b:atp_LocalEnvironments). If you need something different than abbreviation for
\begin{theorem}
<Cursor placed here>
\end{theorem}
for example:
\begin{corollary}
\end{corollary}
You can set the variable g:atp_abbreviation_{environment_name}. It is list
with two elements. First is used after \begin{...} and the second after
\end{...}. For the above examples:
Furthermore, you can change the "=":
It is used in insert mode abbreviations like: =theorem=, =proposition=, =corollary=, =lemma=, etc.
This section describes some limitation of ATP (as you see, this section is not written, but the aim is to make it disappear anyway ;).
There are many debug variables with names g:atp_debug{fname} where {fname} is a shortname of the function for which it will turn on the debug info. These variables are documented in ftplugin/ATP_files/options.vim file.
A possible error which may occur using the :BibSearch commands has a simple cause: we count number of brackets '()', '{}' and '"' (but nor '\"') to see where the bib entry ends and where to join lines. The message error is echoed when more than 30 lines where processed and the matching bracket was not found (or the number of '"' is odd). Look at your bib file at the specified position. Syntax highlighting for bib files can help you finding where such an error is located. (After reading the bib file comment lines and lines which begin with @string are removed, so that the brackets in comment lines do not count.)
visual mode: ie, iE, ae, im, am, ip, ap, iS, aS, <LocalLeader>sc normal and mode: <LocalLeader>sc.
They select the current environment in two ways:
i | - inner |
a | - outer |
e | - environment |
p | - paragraph |
m | - math zones: \(:\), $:$, \[:\], $$:$$, or math environment \begin:\end.ard search is set by ATP |
) | - bracket |
s | - syntax |
'viE' selects a bit more than 'vie' but less than 'vae', it selects a bracket pair before the beginning of the inner part of an environment, so it can be environment name or an option just after.
See the section atp-Viewers_Options how to set options for viewer programs.
| Editor | Custom Text Editor |
| Command | python $HOME/.vim/ftplugin/ATP_files/atp_RevSearch.py '%f' '%l' |
If you set the command as above (with python before the path to atp_RevSearch.py) you do not need to make atp_RevSearch.py executable. Note, that otherwise whenever you update ATP you will have to make the script executable!
If it is not working for you, please report it, you can also use:
NOTE: :SyncTex command uses "--unique" switch for okular. However, when you do not set b:atp_okularOptions to ["--unique"] as well, then using :SyncTex will open new instance of Okular regardless if it was openned or not. You can use "--unique" as an Okular option (in g:atp_okularOptins or b:atp_okularOptions), but the if you open many files tex, all will use only one instance of Okular. This is a limitation of using Okular. Xpdf has a server option which allows for vim->Xpdf communication to the right Xpdf instance.
Then you can use <Shift>+<Left_Mouse> in Okular to synchronize the Vim (gVim) with pdf.
If you want to use Vim you have to run it with the command: >
ATP supports forward (Vim->Xdvi) and inverse (Xdvi->Vim) searching for Xdvi. The forward search is set by ATP (see |atp:SyncTex|), the inverse search is set by:
If you have any nice tip on editing (La)TeX with Vim or ATP :) you can share it here (my email you'll find on top of the help file), or put them on the script web page.
If you want to change the name of a command, you can try:
However, not all functions are defined without <SID> (you can always try to reach me).
Wrap a visual area with wrapper from the register q and with the default '}' end wrapper.
As above but with the end wrapper from register w.
Goto the first spelling error and list
suggestions. Another version is to use ]S and [S instead of ]s and [s.
When the cursor is positioned on \begin{envname} or \end{envname} both corresponding \begin:\end get highlighted with syntax group MatchParen. To disable it type this in ex mode or put it in your atprc file:
There is a colour scheme included: coots-beauty-256. You need 256 colours to use it (in the terminal).
These are the highlights groups defined for various files and the default links:
| highlight atp_FileName | Title | |
| highlight atp_LineNr | LineNr | |
| highlight atp_Number | Number | |
| highlight atp_Chapter | Label | |
| highlight atp_Section | Label | |
| highlight atp_SubSection | Label | |
| highlight atp_Abstract | Label | this group highlights abstract and all the unnumbered chapters and the bibliography. |
| highlight atp_label_FileName | Title |
| highlight atp_label_LineNr | LineNr |
| highlight atp_label_Name | Label |
| highlight atp_label_Counter | Keyword |
this is very much the same as the standard syntax for bib files. Groups are named bibsearch<NAME> instead of bib<NAME>. There is one more group added:
Yet, there is no default highlighting, try coots-beauty-256 colour scheme. If you like it, I'm glad, if you have a nice (non standard) colour scheme, I'm happy to get it, if you like to share it.
The notification message that your compiler is running can be highlighted. For this set the variables:
The variable g:atp_StatusLine is stores the value of Vim option 'statusline'; actually 'statusline' option is set by:
To see some messages that are issued you can use the |:mes| command.
If you find this plugin useful and have some comments you are cordially invited to write to the author: <mszamot [AT] gmail [dot] com>, add some "karma" poitns on vim script page, make a recommendation or write a review on SourceForge: atp-sourceforge.
Best, and hopefully you will find this useful :)
Copyright (C) 2010 Marcin Szamotulski Permission is hereby granted to use and distribute this code, with or without modifications, provided that this copyright notice is copied with it.
Automatic Tex Plugin for Vim is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
Automatic Tex Plugin for Vim is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with Automatic Tex Plugin for Vim. If not, see here.
This licence applies to all files shipped with Automatic Tex Plugin, exluding the following two dictionary files: