Open main menu

Changes

381 bytes added ,  17:16, 30 October 2016
no edit summary
This page is about editing ConTeXt source in Vim, gVim, MacVim, NeoVim, and other Vim clones.
The page describes the scripts available with Vim v8.0.0047 or later.
If you are using an older Vim, you may copy the <tt>context.vim</tt>scripts from Vim's distribution (https://github.com/vim/vim), under the <tt>runtime</tt> directory, into your <tt>vim</tt> folder. Everything should work, atleast with Vim 7.4.
== Using ConTeXt in Vim ==
* AutoComplPop: https://github.com/vim-scripts/AutoComplPop
* SuperTab: https://github.com/ervandew/supertab
 
=== Using LaTeX-Suite ===
 
[http://vim-latex.sourceforge.net/ latex-suite] currently doesn't support ConTeXt, but if you use it, here's what you have to do to compile ConTeXt documents:
 
1. After downloading and installing latex-suite, locate the file "texrc" (usually located in <code>~/.vim/ftplugin/latex-suite</code>). Copy this file to <code>~/.vim/ftplugin/tex/texrc</code>
 
2. Open this copy in your favorite editor (vim comes to mind...)
 
3. After line 80 in this file, there is a series of "Compiler rules." Just add this line to the section:
 
TexLet g:Tex_CompileRule_cont = 'texexec --pdf --nonstopmode $*'
 
This will add compilation for ConTeXT. In order to use it:
 
4. When you're in vim normal mode, run this command:
 
TGTarget cont [that's "colon TGTarger cont"]
 
5. Edit your TeX-files, save the changes; when you want to compile, switch to normal mode and just type <code>\ll</code> (that's '' 'backslash el el' '')
 
Voila, compilation should start. You'll have to specify this compiler target every timeI you open a TeX-file in Vim. If you want to make this the default compiler, you should have this line in your texrc:
 
TexLet g:Tex_DefaultTargetFormat = 'cont'
 
== A note on filetype detection ==
You can put the above settings in your <tt>.vimrc</tt> if you like.
== using latex-suite ==
[http://vim-latex.sourceforge.net/ latex-suite] currently doesn't support ConTeXt, but if you use it, here's what you have to do to compile ConTeXt documents: 1. After downloading and installing latex-suite, locate the file "texrc" (usually located in <code>~/.vim/ftplugin/latex-suite</code>). Copy this file to <code>~/.vim/ftplugin/tex/texrc</code> 2. Open this copy in your favorite editor (vim comes to mind...) 3. After line 80 in this file, there is a series of "Compiler rules." Just add this line to the section:  TexLet g:Tex_CompileRule_cont = 'texexec --pdf --nonstopmode $*' This will add compilation for ConTeXT. In order to use it: 4. When you're in vim normal mode, run this command:  TGTarget cont [that's "colon TGTarger cont"]  5. Edit your TeX-files, save the changes; when you want to compile, switch to normal mode and just type <code>\ll</code> (that's '' 'backslash el el' '') Voila, compilation should start. You'll have to specify this compiler target every timeI you open a TeX-file in Vim. If you want to make this the default compiler, you should have this line in your texrc:= Powerful key mappings ==
In the following, <tt><leader></tt> denotes your “leader” (<tt>:help mapleader</tt>), that is,the prefix for user-defined mappings.By default, the leader is the backslash character, but that may be changed by the user.For example, to use a comma as a leader, put this in your <tt>.vimrc</tt>: TexLet g:Tex_DefaultTargetFormat = 'cont' map <leader> ,
== Powerful key mappings = Buffer-local Insert-mode macros to speed up editing ===
It is useful to add mappings for these commands(By [[User:David antos|D.A. For example: nnoremap <silent> ]q ] 19:<c-u><c-r>=v:count1<cr>cnext<cr>zz nnoremap <silent> [q :<c-u><c-r>=v:count1<cr>cprevious<cr>zzOr install Tim Pope's <i>unimpaired</i> plugin.52, 8 Jul 2005 (CEST))
a set of buffer-local insert-mode macros to speed up ConTeXt source editing (by [[User:David antos|D.A.]] 19:52, 8 Jul 2005 (CEST))
* I have remapped <leader> to comma (one hardly ever use commas just before a letter)
* two types of mappings: stand-alone and changing the previous word
</pre>
It is useful to add mappings for these commands. For example: nnoremap <silent> ]q :<c-u><c-r>=v:count1<cr>cnext<cr>zz nnoremap <silent> [q :<c-u><c-r>=key v:count1<cr>cprevious<cr>zzOr install Tim Pope's <i>unimpaired</i> plugin. === Key mappings borrowed from sciteSciTE== If you use the stand-alone distribution for windowsWindows/Linux.You can reset the key mappingto speed ConTeXt compiling.
just Just add the following code to your <tt>_vimrc</t>> (or <tt>.vimrc </tt> file under Linux) file:
<pre>
"run setup and complie, then open the result pdf file
</pre>
== Makefile Makefiles ==
For your ConTeXt document, you can prepare a Makefile like this one (Contributed by [[User:Buggs|Buggs]]):
134

edits