As we get used to Vim's lightness and do not want to install the extra Tex Editor, we configure Vim according to our usage habits.
1. Install the vim-latex plug-in
- : Http://sourceforge.net/projects/vim-latex/files/
- DownloadVim-latex-1.8.23-20120125.768-git8b62284.tar.gzDecompress the package directly ~ /. Vim
2 Vim Configuration
(1) latex-related configuration in vimrc
- 405 "Vim latex suite
- 406 "http://vim-latex.sourceforge.net/index.php? Subject = download & Title = download
- 407 "make grep always generate file name
- 408 set grepprg = grep \-NH \ $ *
- 409 "Vim sets the empty Tex file to plaintex instead of Tex by default, so that latex-suite is not loaded.
- 410 Let G: tex_flavor = 'latex'
- 411 set iskeyword + =:
- 412 autocmd bufenter *. Tex set Sw = 2
- 413
(2) Modify ~ /. Vim/ftplugin/latex-Suite/texrc to compile the Tex file using xelatex and preview the PDF using evince
- 86 If has ('macunix ')
- 87 texlet G: tex_defaulttargetformat
= 'Pdf'
- 88 else
- 89 texlet G: tex_defaulttargetformat
= 'Pdf '/* all generate PDF */
- 90 endif
- 115 texlet G: tex_compilerule_pdf
= 'Xelatex-interaction = nonstopmode $ * '/* compile with xelatex */
- 145 texlet G: tex_viewrule_pdf
= 'Evince '/* use evince to preview the generated PDF */
3. Tips for using vim-latex
(1) Common shortcut keys
CTRL-J, F5, F7, F9, Shift-F5, Shift-F7,/LL (compile shortcut),/LV (view PDF shortcut),/LS, CTRL-x Ctrl-K (supplemented by dictionary.
(2) Write/CITE {and press F9 without a cross reference. The reason is that the python interface in VIM has some problems with latex-suite. disable it.
You only need ~ /. Vim/ftplugin/latex-Suite/texrc is enabled by default ~ /. Vim/ftplugin/latex-Suite/texrc, Set
Texlet G: tex_usepython = 1
Change
Texlet G: tex_usepython = 0
That's it!
(3) In order to be able to perform a forward search, set the parameters and use/ll for compilation. However, when makefile is available in the working directory,/ll does not execute the set compilation command, but executes makefile, as a result, forward search cannot be performed.
You only need to disable makefile ~ /. Vim/ftplugin/latex-Suite/texrc
Texlet G: tex_usemakefile = 0 (4) set forward search, in ~ /. Specify Let G: tex_compilerule_dvi = 'latex-Src-specials-interaction = nonstopmode $ * 'in vimrc *'
Note: You should also set tctarget DVI. However, if you do not set tctarget DVI, running VI in the above file will prompt an error, but you can execute this command in VI, no matter whether it can be used. After the settings are completed, you need to re-compile the Tex file (use/LL), and then/ls can be searched and previewed.
(5) For convenience, I also made some settings, including shortcut keys, in ~ In/. Vim/ftplugin/tex. VIM:
Map <F4> <ESC>: q <CR> "F4 close the window (buffer)
Map <F2> <ESC>: W <CR>/ll "F2 save and compile
Imap <F2> <ESC>: W <CR>/LL
Map <F3> <ESC>/LV "F3 View
Imap <F3> <ESC>/LV
NMAP <tab> <c-j> "uses the tab key instead of Ctrl-J to redirect.
Imap <tab> <c-j>
Vmap <tab> <c-j>
Set keywordprg =: Help "press the K key to find help for words at the cursor. The default value is man.
Cmap XXX! Make
Set iskeyword + = ., _ "facilitates fig. XX, prl1038512345 and other forms of search completion, otherwise by default, fig is not set. XX is regarded as a word, but as fig and XX. "is used as the separator of the word.
(6) temporarily cancel the definition of the shortcut key. For example, if you want to enter double quotation marks, it will automatically become ''when you press ''.
So how can we disable automatic replacement and directly output?
Remember <Ctrl-V>!
<Ctrl-V> "get"
SS <Ctrl-V> S to get SSS
~ <Ctrl-V> ~ Get ~~