Changes

Jump to navigation Jump to search
No change in size ,  20:59, 30 October 2016
m
no edit summary
* Proper URL highlighting ('%' doesn't start a comment, ...) [request by VnPenguin].
* Perhaps borrow something from https://github.com/lervag/vimtex or http://vim-latex.sourceforge.net/?
 
== A note on filetype detection ==
 
TeX (Plain TeX), LaTex and ConTeXt all use the <tt>.tex</tt> extension for files, which makes it difficult to detect the filetype based on the extension. From Vim 7 onwards, Vim does some intelligent checking to see it the file is <tt>plaintex</tt> or <tt>latex</tt> or <tt>context</tt>.
 
If the first line of a <tt>*.tex</tt> file has the form
%&<format>
then this determines the file type: <tt>plaintex</tt> (for Plain TeX), <tt>context</tt> (for
ConTeXt), or <tt>tex</tt> (for LaTeX). Otherwise, the file is searched for keywords to
choose <tt>context</tt> or <tt>tex</tt>. If no keywords are found, it defaults to <tt>plaintex</tt>.
You can change the default by defining the variable <tt>g:tex_flavor</tt> to the format
(not the file type) you use most. Use one of these:
let g:tex_flavor = "plain"
let g:tex_flavor = "context"
let g:tex_flavor = "latex"
Currently no other formats are recognized.
 
* If you use ConTeXt most of the time, but occasionally use LaTeX or Plain TeX, you can add the following to your <tt>.vimrc</tt>
let g:tex_flavor = "context"
* If you only use ConTeXt, you can add the following lines to <tt>filetype.vim</tt>:
" ConTeXt
augroup filetypedetect
au! BufRead,BufNewFile *.tex setfiletype context
augroup END
so the next time you open a <tt>*.tex</tt> file, Vim will always recognize it as a ConTeXt document.
 
== A note on spell checking ==
 
Vim 7 or later has a built-in spell checker. To enable it or disable it, use:
:set spell
or
:set nospell
respectively.
To set the language to be used for spell checking, set the <tt>spelllang</tt> option accordingly. For example:
:set spelllang=en_us
Use lowercase letters (<tt>en_us</tt>, not <tt>en_US</tt>). When you set <tt>spelllang</tt>, Vim offers to
download the language data into your <tt>.vim</tt> folder, if such language is not available.
You can put the above settings in your <tt>.vimrc</tt> if you like.
== Other useful Vim plugins ==
TexLet g:Tex_DefaultTargetFormat = 'cont'
 
== A note on filetype detection ==
 
TeX (Plain TeX), LaTex and ConTeXt all use the <tt>.tex</tt> extension for files, which makes it difficult to detect the filetype based on the extension. From Vim 7 onwards, Vim does some intelligent checking to see it the file is <tt>plaintex</tt> or <tt>latex</tt> or <tt>context</tt>.
 
If the first line of a <tt>*.tex</tt> file has the form
%&<format>
then this determines the file type: <tt>plaintex</tt> (for Plain TeX), <tt>context</tt> (for
ConTeXt), or <tt>tex</tt> (for LaTeX). Otherwise, the file is searched for keywords to
choose <tt>context</tt> or <tt>tex</tt>. If no keywords are found, it defaults to <tt>plaintex</tt>.
You can change the default by defining the variable <tt>g:tex_flavor</tt> to the format
(not the file type) you use most. Use one of these:
let g:tex_flavor = "plain"
let g:tex_flavor = "context"
let g:tex_flavor = "latex"
Currently no other formats are recognized.
 
* If you use ConTeXt most of the time, but occasionally use LaTeX or Plain TeX, you can add the following to your <tt>.vimrc</tt>
let g:tex_flavor = "context"
* If you only use ConTeXt, you can add the following lines to <tt>filetype.vim</tt>:
" ConTeXt
augroup filetypedetect
au! BufRead,BufNewFile *.tex setfiletype context
augroup END
so the next time you open a <tt>*.tex</tt> file, Vim will always recognize it as a ConTeXt document.
 
== A note on spell checking ==
 
Vim 7 or later has a built-in spell checker. To enable it or disable it, use:
:set spell
or
:set nospell
respectively.
To set the language to be used for spell checking, set the <tt>spelllang</tt> option accordingly. For example:
:set spelllang=en_us
Use lowercase letters (<tt>en_us</tt>, not <tt>en_US</tt>). When you set <tt>spelllang</tt>, Vim offers to
download the language data into your <tt>.vim</tt> folder, if such language is not available.
You can put the above settings in your <tt>.vimrc</tt> if you like.
== Powerful key mappings ==
134

edits

Navigation menu