Vim-latex: Difference between revisions
Jump to navigation
Jump to search
(→Troubleshooting: fix slow opening because of itemize auto-folding) |
|||
Line 11: | Line 11: | ||
let g:Tex_DefaultTargetFormat = 'pdf' |
let g:Tex_DefaultTargetFormat = 'pdf' |
||
</source> |
</source> |
||
== Mappings == |
|||
{| class="wikitable" width="100%" |
|||
|+Plugin - vim-latex |
|||
|- |
|||
|width="120px"| |
|||
{{kbctrl|m}}<br/> |
|||
{{kb|F5}}<br/> |
|||
{{kb|S-F5}}<br/> |
|||
{{kb|F7}}<br/> |
|||
{{kb|S-F7}}<br/> |
|||
EEQ ,eq<br/> |
|||
FSF `sf<br/> |
|||
{{kb|A-l}}<br/> |
|||
{{kb|A-b}}<br/> |
|||
{{kb|A-c}}<br/> |
|||
'''{{kb|A-o}}'''<br/> |
|||
{{kb|F6}} \rf<br/> |
|||
| |
|||
Jump to next<br/> |
|||
Insert/expand/enclose in environment<br/> |
|||
Change environment<br/> |
|||
Insert/expand/enclose in command<br/> |
|||
Change command<br/> |
|||
Insert / enclose in ''equation''<br/> |
|||
Insert / enclose in font ''\textsf{}''<br/> |
|||
Expand ([|{<q or label<br/> |
|||
Enclose in \\mathbf{}<br/> |
|||
\\mathcal{} or \\cite{}<br/> |
|||
Insert \\item{} (was {{kb|A-i}})<br/> |
|||
Refresh folds<br/> |
|||
|} |
|||
== Troubleshooting == |
== Troubleshooting == |
Revision as of 16:15, 19 May 2019
General
- quickstart
- manual
- vim-latex cheat sheet
vilatexcheat
Configuration
- To select pdf as default compile format, add to file .vim/ftplugin/tex.vim:
" Set default compile target type as 'pdf'
let g:Tex_DefaultTargetFormat = 'pdf'
Mappings
^m |
Jump to next |
Troubleshooting
- Use A-o to insert
\item\
instead of A-i, because the latter collides with roman letter é. Also remap A-o such that it also works in the console (^[o
is obtained via C-vC-o):
--- a/.vim/ftplugin/latex-suite/envmacros.vim
+++ b/.vim/ftplugin/latex-suite/envmacros.vim
- imap <buffer> <M-i> <Plug>Tex_InsertItemOnThisLine
+ imap <buffer> <M-o> <Plug>Tex_InsertItemOnThisLine
+ set <M-o>=^[o
- My .vimrc configuration:
"############################################################################################################
" VIM-LATEX
"############################################################################################################
" REQUIRED. This makes vim invoke Latex-Suite when you open a tex file.
filetype plugin on
" IMPORTANT: win32 users will need to have 'shellslash' set so that latex
" can be called correctly.
" set shellslash
" IMPORTANT: grep will sometimes skip displaying the file name if you
" search in a singe file. This will confuse Latex-Suite. Set your grep
" program to always generate a file-name.
set grepprg=grep\ -nH\ $*
" OPTIONAL: This enables automatic indentation as you type.
filetype indent on
" OPTIONAL: Starting with Vim 7, the filetype of empty .tex files defaults to
" 'plaintex' instead of 'tex', which results in vim-latex not being loaded.
" The following changes the default filetype back to 'tex':
let g:tex_flavor='latex'
" Use <C-l> for jump formward instead of <C-J>
imap <C-l> <Plug>IMAP_JumpForward
nmap <C-l> <Plug>IMAP_JumpForward
vmap <C-l> <Plug>IMAP_JumpForward
- To have a LaTeX file compile with XeLaTeX automatically:
:let g:Tex_CompileRule_pdf = 'xelatex -interaction=nonstopmode '
- In multiple file setup, touch file main.tex.latexmain to indicate vim-latex that main.tex is the main file and should always compile this file, independently of what file is currently edited. See also variable
Tex_MainFileExpression
(see manual):
let g:Tex_MainFileExpression = 'MainFile(modifier)'
- vim-latex creates automatically new folds for every itemize / enumeration / description blocks. This considerably slows down or blocks opening of beamer presentation that usually contains a lot of these blocks. Here a patch to disable this.
--- a/.vim/ftplugin/latex-suite/folding.vim
+++ b/.vim/ftplugin/latex-suite/folding.vim
@@ -237,16 +237,16 @@ function! MakeTexFolds(force)
" }}}
" {{{ items
- if g:Tex_FoldedMisc =~ '\<item\>'
- call AddSyntaxFoldItem (
- \ '^\s*\\item',
- \ '^\s*\\item\|^\s*\\end{\(enumerate\|itemize\|description\)}',
- \ 0,
- \ -1,
- \ '^\s*\\begin{\(enumerate\|itemize\|description\)}',
- \ '^\s*\\end{\(enumerate\|itemize\|description\)}'
- \ )
- endif
+ " if g:Tex_FoldedMisc =~ '\<item\>'
+ " call AddSyntaxFoldItem (
+ " \ '^\s*\\item',
+ " \ '^\s*\\item\|^\s*\\end{\(enumerate\|itemize\|description\)}',
+ " \ 0,
+ " \ -1,
+ " \ '^\s*\\begin{\(enumerate\|itemize\|description\)}',
+ " \ '^\s*\\end{\(enumerate\|itemize\|description\)}'
+ " \ )
+ " endif
" }}}
" {{{ title
Keyboard and shortcuts
command | description |
---|---|
o keyword F5 | Insert environment keyword
amsmathF5
|
i EFL | Insert environment flushleft Expand the 3-letter sequence EFL. Equivalent to i flushleft F5 |
v select text ,fl | Enclose selected text in environment flushleft. |
S-F5 | Change enclosing environment |
F7 | Insert command |
S-F7 | Change enclosing command |
\ll | Compile |
\lv | View compiled file |
command | description |
---|---|
(insert mode) C-u | Go to next placeholder
amsmathF5sumlimits,C-u |
(insert mode, eqn context) ^^ | Quick exponent (template e^{}<++> )
eqnarrayF5e^^j
|
(insert mode, eqn context) __ | Quick subscript (template e_{}<++>
eqnarrayF5a__i
|
Auc-Tex Key Binding | description |
---|---|
`p | \pi
|
`8 | \infty
|
`/ | \frac
|
`% | \frac
|
`0 | ^\circ
|