Vim-latex: Difference between revisions

From miki
Jump to navigation Jump to search
(Created page with "== General == * [http://vim-latex.sourceforge.net/documentation/latex-suite-quickstart.html quickstart] * [http://vim-latex.sourceforge.net/documentation/latex-suite.html manu...")
 
(→‎Troubleshooting: Split keyboard and shortcuts section)
Line 63: Line 63:
</source>
</source>


;Keyboard and shortcuts
== Keyboard and shortcuts ==
{| class=wikitable
{| class=wikitable
|-
|-

Revision as of 12:53, 27 January 2015

General

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'

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)'

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