Changes

Jump to navigation Jump to search
15,296 bytes added ,  06:57, 31 July 2023
m
< [[Text Editors]] | [[Related Programs]] >
httphttps://www.vim.org/
This page will be is about editing ConTeXt source in (g)vimVim, gVim, MacVim, and other Vim clones.The page describes the scripts available in Vim v8.0.0055 or later. If you are using Vim 7, see''Using the scripts with an older Vim'' below.
<b>If you feel that something is missing, please contribute!</b> Information about providing feedback is in the header of the scripts. == Filetype detection Using ConTeXt in Vim ==Tex Nikolai Weibull was the first one who wrote <tt>context.vim</tt> files and submitted them to the official Vim repository.They are part of the official Vim 7, and were expanded and improved in Vim 8. Starting with Vim 9.0.0218, the scripts supporting ConTeXt in Vim have been rewritten in Vim 9 script (the new Vim's scripting language). For the complete documentation, see <tt>:help ft-context</tt>. === Asciicast === [[File:context-in-vim.png]] This asciicast[https://asciinema.org/a/91111] gives you a taste of ConTeXt editing in Vim. === Typesetting === The recommended way to typeset a ConTeXt document is to use the <tt>:ConTeXt</tt> command. Just type: :ConTeXt %to compile the document in the current buffer.Typesetting happens in the background,so you may continue working on your document. If there are errors, the quickfix window will open automaticallyto show the errors (one per line). The cursor will stay in the main document, so your typing workflow will notbe disrupted. You may use standard quickfix commands to jump between errors: <tt>:cfirst</tt>, <tt>:cprev</tt>,<tt>:cnext</tt>, etc… (plain texsee <tt>:help quickfix</tt>). See below for useful mappings for these commands. If your document is typeset without errors, <tt>Success!</tt> is printed at the bottom of the screen. The <tt>:ConTeXt</tt> command accepts an optional path, in case you want to typeset a document differentfrom the current one (useful for big projects). You may check the status of your ConTeXt jobs with <tt>:ConTeXtJobStatus</tt>, latex and you may stop allrunning jobs with <tt>:ConTeXtStopJobs</tt>. === Setting a custom typesetting engine === The <tt>:ConTeXt</tt> command invokes the <tt>mtxrun</tt> script that is found in <tt>$PATH</tt>. For more fine grained control over the command and its environment, you may invoke `context.Typeset()` directly (or `context#Typeset()` from legacy Vim script). For instance, if you have installed a version of ConTeXt in <tt>$HOME/context all </tt> (where <tt>$HOME</tt> is the path to your home directory), you may define a function to use it similar to the following (you may put the following code in <codett>~/.vim/after/ftplugin/context.vim</tt>, creating the file and the directories if they do not exist):  import autoload 'context.vim'  def MyConTeXt() const env = {'PATH': printf("%s/context/tex/texmf-<os>-<arch>/codebin:%s", $HOME, $PATH)} context.Typeset("%", env) enddef and perhaps use it with a mapping:  nnoremap <silent><buffer><leader>t <scriptcmd>MyConTeXt()<cr> <tt>context.Typeset()</tt> accepts a third optional argument to specify a customtypesetting command. That must be a function that takes a path and returns thecommand as a List. For example:  def ConTeXtCustomCommand(path: string): list<string> extension for return ['mtxrun', '--script', 'context', '--nonstopmode', path] enddef  context.ConTeXtTypeset("%", v:none, ConTeXtCustomCommand) === Working with large projects === Large projects are often organized as a root document and various chapterfiles which makes . When editing a chapter file, it is convenient to invoke <tt>:ConTeXt</tt>directly on it difficult , rather than having to switch to detect the filetype based on root file. A “magic line”can be added at the beginning of each chapter file, which specifies therelative path to the extensionroot file. From For instance:  % !TEX root = ../MyRoot.tex Vim 7 onwardssearches for the magic line in the first ten lines of the current buffer:if the magic line is found, vim the document specified by that line is typeset rather than theone in the current buffer. The root document does some intelligent checking not have to be opened inVim. === Updating the syntax files === Vim includes syntax files generated by <tt>mtxrun</tt>. If you want to see it use more up-to-date files, overriding those distributed with Vim, you may proceed as follows. Assuming your Vim configuration lives in <tt>~/.vim</tt>, you may type:  mkdir -p ~/.vim/syntax/shared cd ~/.vim/syntax/shared mtxrun --script interface --vim The last command will create the file is plaintex or latex or following syntax files: * <tt>context-data-context.vim</tt>;* <tt>context-data-interfaces.vim</tt>;* <tt>context-data-metafun.vim</tt>;* <tt>context-data-tex.vim</tt>.  === Editing features === You may use the following commands to quickly jump to different parts of your document:
If * <tt>[[</tt>: jump to the first line previous start of a subject, section, chapter, part, component, or product;*.tex file has the form %&<formattt>]]</tt>then this determined : jump to the file type: plaintex (for plain TeX)next start of subject, section, chapter, context (forConTeXt)part, or tex (for LaTeX). Otherwisecomponent, the file is searched for keywords tochoose context or tex. If no keywords are found, it defaults to plaintex.product;You can change the default by defining the variable g* <tt>[]</tt>:tex_flavor jump to the formatprevious end of section, chapter, etc…;(not * <tt>][</tt>: jump to the file type) you use most. Use one next end of these: section, chapter, etc…; let g* <tt>[{</tt>:tex_flavor = "plain"jump to the previous <tt>\start…</tt> or <tt>\setup…</tt> command; let g* <tt>]}</tt>:tex_flavor = "context" let g:tex_flavor = "latex"Currently no other formats are recognized.jump to the next <tt>\stop…</tt> or <tt>\setup…</tt> command;
* If you use ConTeXt most Each of the time, but occasionally use latex or plaintexabove accepts an optional count. For example, you can add the following to your may type <codett>.vimrc3[{</codett> let g:tex_flavor = "context"* If you only use ConTeXt, you can add the following lines to filetype.vim: " ConTeXt augroup filetypedetectjump au! BufRead,BufNewFile *.tex setfiletype context augroup ENDso the next time you open a three <codett>*.tex\start…</codett> file, vim will recognise always recognize it as a context filecommands before.
== SpellYou may use the following ConTeXt-checker ==specific text objects, to be used in Visual or Operator-pending mode(see <tt>:help text-objects</tt>):
Vim 7 has a built-in spell checker, butenabling the spell-checker has been "forgotten" in * <codett>context.vimi$</codett>. Either say :syn spell toplevelafter opening the document or add syn spell toplevelinside <tt>$…$</tt> (dollars excluded);somewhere on the top of * <codett>runtimea$</syntaxtt>: around <tt>$…$</context.vimtt> (dollars included);* <tt>tp</codett>, as in: runtime! syntax/plaintexa ConTeXt paragraph.vim let s:cpo_save = &cpo set cpo&vim syn spell toplevel
AdditionallySo, for example, you have to setmay copy (“yank” in Vim's jargon) a paragraph by typing <tt>ytp</tt> (“yank a TeX :set spell spelllang=en_usor the language of your preference once you have installed paragraph“), delete it with <tt>dtp</tt>, select it into vim.Use lowercase letters (with <codett>en_usvtp</codett> not , reflow it with <codett>en_USgqtp</codett>)., etc…You can put this line in your Similarly, you may yank a formula with <tt>vi$</tt> (or <codett>.vimrcva$</codett> if you like), and delete it, select it, etc…, in asimilar fashion.
== ftplugin If you have enabled the <tt>matchit</tt> plugin included in Vim (see <tt>:help matchit</tt>), you may alsotype <tt>%</tt> to jump between matching <tt>\start…</tt> and syntax file ==<tt>\stop…</tt> commands, or betweenmatching parentheses.
Nikolai Weibull was You may jump to a different file by positioning the first one who wrote contextcursor over the file name and typing <tt>gf</tt> (<tt>:help gf</tt>).vim files and submitted them to For example, if you have the official vim cvs repository.following in your document: \component my_componentThey are part of putting the official Vim 7cursor over <tt>my_component</tt> and pressing <tt>gf</tt> will open <tt>my_component.tex</tt>.
If you are using an older VimSimilarly, you can download may use <tt>[<c-i></tt> (this is square bracket followed by ctrl-i)to jump to the files at:definition of the word under the cursor (even if it is in a different* file), or <tt>[http:i<//cvstt> to display the (first line of the) definition under the status line.sourceforge.net/viewcvs.py/vim/vim7/runtime/syntax/context.vim runtime/syntax/context.vim] - syntax highlightingFor these and similar commands,* [httpsee <tt>:help include-search<//cvs.sourceforge.net/viewcvs.py/vim/vim7/runtime/ftplugin/contexttt>.vim runtime/ftplugin/context.vim] - filetype specific behaviour (like repeating comments at the beginning of line)
Vim searches for files in the locations specified by the <tt>path</tt> option. You may
need to adjust the value of <tt>path</tt> for the above to work (see <tt>:help 'path'</tt>).
It's mostly up to you which syntax highlighting scheme you prefer. <code>context.vim</code> is a lighter version than <code>tex.vim</code>. It knows some ConTeXt details that are not implemented in <code>tex.vim</code>, while math and some other TeX features are not supported yet in <code>context.vim</code>.=== Integration with MetaPost ===
Vim offers excellent support for editing METAFONT and MetaPost documents (<btt>If you feel that something is missingmf</tt> and <tt>mp</tt> filetypes).See <tt>:help ft-metapost</tt> for the details.Most of the features of such filetypes work also inside ConTeXt's MetaPost environments, please contribute!such as <tt>\startMPpage… \stopMPpage</btt>.
=== TODO ===In particular, Vim automatically highlights and indents MetaPost and MetaFun code inside a ConTeXt document.Besides, when you are inside a MetaPost environment, you may press CTRL-X followed by CTRL-Oto complete a MetaPost/MetaFun keyword (see below for a list of several autocompletion plugins to streamline this).This works out of the box: no configuration is required. Watch the asciicast above for a demo.
* extract data from texweb and create syntax highlighting definitions for ConTeXt* add metafun macros (from metafun manual)* enable metapost/metafun, JavaScript and XML inside ConTeXt* some essential math support* proper URL highlighting ('%' doesn't start a comment, ...) [request by VnPenguin]* perhaps borrow something from http://vim-latex.sourceforge.net/?* vim auto-complete for vim=== Integration with other languages ===
== compiler plugin ==Lua syntax highlighting is used inside <tt>\directlua{}</tt> and <tt>\ctxlua{}</tt> commands,and inside <tt>\startluacode… \stopluacode</tt>. XML highlighting is used inside <tt>\startXML… \stopXML</tt>.
Context complier plugin for vim is available from httpYou may embed other filetypes. Just define <tt>g:context_include</tt> (or <tt>b:context_include</wwwtt> forbuffer-specific settings).vim.orgFor example, if you want to highlight C++ code inside, say, <tt>\startCPP… \stopCPP</scripts/scripttt>,define: let g:context_include = { 'cpp' : 'CPP' }The key is the name of the filetype and the corresponding value is name of the command.php?script_id=1925
After installing this, you can compile a TeX file using=== Using the scripts with an older Vim ===
If you are using an older Vim, you may copy the following scripts from Vim's distribution (https://github.com/vim/vim) into correspondingfolders in your <tt>.vim</tt> folder (so, for example <tt>runtime/ftplugin/context.vim</tt> must be copied into<tt>~/.vim/ftplugin/context.vim</tt>):make %
which will also highlight the error messages runtime/autoload/context. If you prefer keymappingsvim runtime/autoload/contextcomplete.vim runtime/compiler/context.vim runtime/ftplugin/{context,mf,mp}.vim runtime/indent/{context,mf, you can addmp}.vim runtime/syntax/{context,mf,mp}.vim
nmap <F5b> make %Note:<cr/b>the runtime scripts in Vim 9.0.0218 or later are written in Vim 9 script (the new scripting language embedded in Vim) and there is no guarantee that they will work with older versions of Vim!
to your <code>.vimrc</code> If you get the following error when you open a ConTeXt or your <code>ftplugin/context.vim</code>, after which pressing <code><F5></code> will compile the file.MetaPost document:
== Other useful vim plugins == E410: Invalid :syntax subcommand: iskeyword
* autocomplete: http:edit the syntax files and remove the <tt>syn iskeyword</tt> or <tt>syntax iskeyword</vimtt> line.sourceforgeInstead, put a corresponding command in <tt>~/.netvim/scripts/script.php?script_id=182, almost undocumented, but life-saving* spell-checker: http:after/ftplugin/wwwcontext.vim.org</scripts/script.php?script_id=499, but native spell-checking support is included in Vim 7 (see above).tt>:
setlocal iskeyword== using latex@,48-57,a-z,A-Z,192-suite ==255
[http:and in <tt>~/.vim/after/ftplugin/mp.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 documentstt> for MetaPost:
1. After downloading and installing latex-suite setlocal iskeyword=@, locate the file "texrc" (usually located in <code>~/.vim/ftplugin/latex-suite</code>). Copy this file to <code>~/.vim/ftplugin/tex/texrc</code>_
2Everything should work, at least with Vim 7. Open this copy in your favorite editor (vim comes to mind4...)
3. After line 80 in this file, there is a series of "Compiler rules." Just add this line to the section:=== TODO ===
TexLet g* Some essential math support.* Proper URL highlighting ('%' doesn't start a comment, ...) [request by VnPenguin].* Perhaps borrow something from https:Tex_CompileRule_cont = 'texexec --pdf -//github.com/lervag/vimtex or http://vim-nonstopmode $*'latex.sourceforge.net/?
This will add compilation for ConTeXT. In order to use it:== Filetype detection ==
4TeX (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. When you're in vim normal modeFrom Vim 7 onwards, run this command: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 TGTarget cont [that's %&<format>then this determines the file type: <tt>plaintex</tt> (for Plain TeX), <tt>context</tt> (forConTeXt), or <tt>tex</tt> (for LaTeX). Otherwise, the file is searched for keywords tochoose <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 = "colon TGTarger contlatex"] Currently no other formats are recognized.
5. Edit your * If you use ConTeXt most of the time, but occasionally use LaTeX or Plain TeX-files, save you can add the changes; when following to your <tt>vimrc</tt> let g:tex_flavor = "context"* If you want only use ConTeXt, you can add the following lines to compile<tt>filetype.vim</tt>: " ConTeXt augroup filetypedetect au! BufRead, switch to normal mode and just type BufNewFile *.tex setfiletype context augroup ENDso the next time you open a <codett>\ll*.tex</codett> (that's '' 'backslash el el' '')file, Vim will always recognize it as a ConTeXt document.
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:== Spell checking ==
Vim 7 or later has a built-in spell checker. To enable it or disable it, use: :set spellor :set nospellrespectively.To set the language to be used for spell checking, set the <tt>spelllang</tt> option accordingly. For example: TexLet g:Tex_DefaultTargetFormat set spelllang= 'cont' en_usUse lowercase letters (<tt>en_us</tt>, not <tt>en_US</tt>). When you set <tt>spelllang</tt>, Vim offers todownload 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 ==
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>: map <leader> ,Rather than overriding the default leader, you may define an alternative key. The <tt><space></tt> is a goodchoice, because by default it has the same function as the <tt><right></tt> key, and it is comfortable to type: map <space> <leader> " Use <space> as an alternative leader (backslash can still be used) === Clean up auxiliary files === The following function can be used to clean up temporary files: fun! ConTeXtClean() let l:currdir = expand("%:p:h") let l:tmpdirs = ['out'] " Temporary directories let l:suffixes = ['aux', 'bbl', 'blg', 'fls', 'log', 'tuc'] " Suffixes of temporary files for ff in glob(l:currdir . '/*.{' . join(l:suffixes, ',') . '}', 1, 1) call delete(ff) endfor for dd in l:tmpdirs let l:subdir = l:currdir . '/' . dd if isdirectory(l:subdir) for ff in glob(l:subdir . '/*.{' . join(l:suffixes, ',') . '}', 1, 1) call delete(ff) endfor endif call delete(l:subdir) " Delete directory (only if empty) endfor echomsg "Aux files removed" endfCustomize <tt>l:tmpdirs</tt> and <tt>l:suffixes</tt> to suit your needs.In Windows systems, you may have to replace each slash with a backslash, too. The following mapping allows you to remove auxiliary files by pressing <tt>\tc</tt>: nnoremap <silent><buffer> <leader>tc :<c-u>call ConTeXtClean()<cr> === Snippets === Vim allows you to define abbreviations for frequently used pieces of text (see <tt>:help abbreviations</tt>).Here are a few examples:<pre>fun! Eatchar(pat) " See :help abbreviations let c = nr2char(getchar(0)) return (c =~ a:pat) ? '' : cendfun iab <buffer> ch- \startchapter[title={<c-o>ma}]<cr><c-o>mb<cr>\stopchapter<esc>`a`b<c-o>a<c-r>=Eatchar('\s')<cr>iab <buffer> s- \startsection[title={<c-o>ma}]<cr><c-o>mb<cr>\stopsection<esc>`a`b<c-o>a<c-r>=Eatchar('\s')<cr>iab <buffer> ss- \startsubsection[title={<c-o>ma}]<cr><c-o>mb<cr>\stopsubsection<esc>`a`b<c-o>a<c-r>=Eatchar('\s')<cr>iab <buffer> sss- \startsubsubsection[title={<c-o>ma}]<cr><c-o>mb<cr>\stopsubsubsection<esc>`a`b<c-o>a<c-r>=Eatchar('\s')<cr>iab <buffer> slide- \startslide[title={<c-o>ma}]<cr><c-o>mb<cr>\stopslide<esc>`a`b<c-o>a<c-r>=Eatchar('\s')<cr>iab <buffer> fig- \startplacefigure<cr><tab>\externalfigure[<c-o>ma]%<cr>[]<c-o>mb<cr><c-d>\stopplacefigure<esc>`a`b<c-o>a<c-r>=Eatchar('\s')<cr>iab <buffer> item- \startitemize<cr><cr>\stopitemize<up><tab>\itemiab <buffer> enum- \startitemize[n]<cr><cr>\stopitemize<up><tab>\itemiab <buffer> i- \item</pre> Type the abbreviation followed by Space to expand the snippet, then continue typing normally. Inside the definition of an abbreviation, marks may be set (see <tt>:h m</tt>), which allow you to jump between the differentparts of buffera snippet with TAB (CTRL-i) and CTRL-O (in Normal mode) after the abbreviation is expanded (see <tt>:h jump-motions</tt>).For example, after typing <tt>ch- </tt>, the cursor will be at the title's position. If you press <tt><esc><tab></tt> (or<tt><c-o><tab></tt> if you want to stay in Insert mode after the jump), you will jump between <tt>\startchapter</tt>and <tt>\stopchapter</tt>. === Buffer-local insertInsert-mode macros to speed up ConTeXt source editing === (by 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>
==key = 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</tt> (or <tt>.vimrc </tt> file under Linux) file:
<pre>
"run setup and complie, then open the result pdf file
"run setup and make list of the current file
map <F8> <Esc><Esc>:sil ! "D:\context\tex\setuptex.bat && texmfstart texexec.pl --autopdf --pdf --list --result=%:p:r_list %"<CR><CR>
</pre>
 
=== Quickfix mappings ===
It is useful to define mappings for quickfix commands, to be able to navigate among ConTeXt errors.For example: nnoremap <silent> ]q :<c-u><c-r>=v:count1<cr>cnext<cr>zz nnoremap <silent> [q :<c-u><c-r>=v:count1<cr>cprevious<cr>zz nnoremap <silent> ]Q :<c-u>clast<cr>zz nnoremap <silent> [Q :<c-u>cfirst<cr>zzOr install Tim Pope's <i>unimpaired</prei>plugin.
== Makefile Makefiles ==
For your ConTeXt document, you can prepare a Makefile like this one (Contributed by [[User:Buggs|Buggs]]):
# An example Makefile to compile a context file, paper.tex
paper.pdf: paper.tex
texexec context paper
test:
clean:
rm *.bbl aux *.dvi bbl *.aux blg *.log *.blgtuc
If you put these mappings to your <code>.vimrc</code> file, you can than then compile the document with F9 and preview it with F8:
" map ":make" to the F9 key
imap <F9> <ESC>:exe "lcd" fnameescape(expand("%:p:h"))<CR>:make<CR> nmap <F9> :exe "lcd" fnameescape(expand("%:p:h"))<CR> :make<CR>
"map ":make test" to the F8 key
imap <F8> <ESC>:exe "lcd" fnameescape(expand("%:p:h"))<CR>:make test<CR> nmap <F8> :exe "lcd" fnameescape(expand("%:p:h"))<CR> :make test<CR> Note that if you use <tt>:make</tt> typesetting will happen synchronously. == Other useful Vim plugins == === Autocompletion === Vim offers a rich completion mechanism (<tt>:help ins-completion</tt>), but there are several pluginsthat improve on it, in particular, to provide automatic completion of keywords: * MUcomplete[https://github.com/lifepillar/vim-mucomplete]* Coc [https://github.com/neoclide/coc.nvim].* Completor[https://github.com/maralla/completor.vim]* NeoComplete[https://github.com/Shougo/neocomplete.vim]* Deoplete (for NeoVim)[https://github.com/Shougo/deoplete.nvim]* YouCompleteMe[https://github.com/Valloric/YouCompleteMe]* AutoComplPop[https://github.com/vim-scripts/AutoComplPop]* SuperTab[https://github.com/ervandew/supertab]
In the asciicast at the top of this page MUcomplete was used.
== MetaPost extension = UltiSnips ===
Should highlight the syntax between <code>btexUltiSnips[https:/verbatimtex</code> github... <code>etex<com/SirVer/code> as TeXultisnips] is a sophisticated snippets manager.Here are a few examples of useful UltiSnips snippets for ConTeXt:
This snippet "s(tart)?" "start / stop" br \start${1:something}$2 ${3:${VISUAL}} \stop$1 endsnippet snippet enum "Enumerate" b \startitemize[n] \item ${0:${VISUAL}} \stopitemize endsnippet snippet item "Itemize" b \startitemize \item ${0:${VISUAL}} \stopitemize endsnippet snippet it "Individual item" b \item ${0:${VISUAL}} endsnippet snippet fig "External figure" b \startplacefigure \externalfigure[${1:${VISUAL}}][$2] \stopplacefigure endsnippet Save the above text into <tt>~/.vim/UltiSnips/context.snippets</tt>. Click on the asciicast linked at the top of this document to see UltiSnips snippets in action. === Outline of a document === Tagbar[https://github.com/majutsushi/tagbar] is a useful plugin to display an outline or a table of contents of a document.It uses Ctags, which you must install, too. Ctags does not support ConTeXt out of the box, but it is easy to extend.Create a <tt>.ctags</tt> file in your home directory, then copy and paste the following:  --langdef=context --regex-context=/^<nowiki>[[</nowiki>:space:<nowiki>]]</nowiki>*\\startsection<nowiki>[[</nowiki>:space:<nowiki>]]</nowiki>*\<nowiki>[[</nowiki>^<nowiki>]]</nowiki>*title<nowiki>[[</nowiki>:space:<nowiki>]]</nowiki>*=<nowiki>[[</nowiki>:space:<nowiki>]]</nowiki>*\{<nowiki>[[</nowiki>:space:<nowiki>]]</nowiki>*(.+)\}/\. \1/s,section/ --regex-context=/^<nowiki>[[</nowiki>:space:<nowiki>]]</nowiki>*\\startsubsection<nowiki>[[</nowiki>:space:<nowiki>]]</nowiki>*\<nowiki>[[</nowiki>^<nowiki>]]</nowiki>*title<nowiki>[[</nowiki>:space:<nowiki>]]</nowiki>*=<nowiki>[[</nowiki>:space:<nowiki>]]</nowiki>*\{<nowiki>[[</nowiki>:space:<nowiki>]]</nowiki>*(.+)\}/\.\. \1/s,subsection/ --regex-context=/^<nowiki>[[</nowiki>:space:<nowiki>]]</nowiki>*\\startsubsubsection<nowiki>[[</nowiki>:space:<nowiki>]]</nowiki>*\<nowiki>[[</nowiki>^<nowiki>]]</nowiki>*title<nowiki>[[</nowiki>:space:<nowiki>]]</nowiki>*=<nowiki>[[</nowiki>:space:<nowiki>]]</nowiki>*\{<nowiki>[[</nowiki>:space:<nowiki>]]</nowiki>*(.+)\}/\.\.\. \1/s,subsubsection/ --regex-context=/^<nowiki>[[</nowiki>:space:<nowiki>]]</nowiki>*\\startchapter<nowiki>[[</nowiki>:space:<nowiki>]]</nowiki>*\<nowiki>[[</nowiki>^<nowiki>]]</nowiki>*title<nowiki>[[</nowiki>:space:<nowiki>]]</nowiki>*=<nowiki>[[</nowiki>:space:<nowiki>]]</nowiki>*\{<nowiki>[[</nowiki>:space:<nowiki>]]</nowiki>*(.+)\}/\1/c,chapter/ --regex-context=/^<nowiki>[[</nowiki>:space:<nowiki>]]</nowiki>*\\startsubject<nowiki>[[</nowiki>:space:<nowiki>]]</nowiki>*\<nowiki>[[</nowiki>^<nowiki>]]</nowiki>*title<nowiki>[[</nowiki>:space:<nowiki>]]</nowiki>*=<nowiki>[[</nowiki>:space:<nowiki>]]</nowiki>*\{<nowiki>[[</nowiki>:space:<nowiki>]]</nowiki>*(.+)\}/SUBJ \1/c,subject/ --regex-context=/^<nowiki>[[</nowiki>:space:<nowiki>]]</nowiki>*\\startpart<nowiki>[[</nowiki>:space:<nowiki>]]</nowiki>*\<nowiki>[[</nowiki>^<nowiki>]]</nowiki>*title<nowiki>[[</nowiki>:space:<nowiki>]]</nowiki>*=<nowiki>[[</nowiki>:space:<nowiki>]]</nowiki>*\{<nowiki>[[</nowiki>:space:<nowiki>]]</nowiki>*(.+)\}/\1/p,part/ Put this in your <tt>vimrc</tt>: let g:tagbar_type_context = { \ 'ctagstype': 'context', \ 'kinds': [ \ 'p:parts', \ 'c:chapters', \ 's:sections' \ ], \ 'sort': 0 \ } That's it! See the image at the top of this document for an example. === Using LaTeX-Suite === [http://vim-latex.sourceforge.net/ latex-suite] currently doesn't work 100% 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 (problems with commands inside commentsvim 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: If anyone knows how   TGTarget cont [that's "colon TGTarger cont"]  5. Edit your TeX-files, save the changes; when you want to compile, switch to repair normal mode and just type <code>\ll</code> (that's '' 'backslash el el' '') Voila, please do socompilation should start. You'll have to specify this compiler target every timeI you open a TeX-file in Vim. It would be nice if If you want to make this would the default compiler, you should have landed this line in the official metapost syntax highlighting script for vim one day.your texrc:  TexLet g:Tex_DefaultTargetFormat = 'cont'
unlet b:current_syntax
syn include @texTop syntax/tex.vim
" MetaPost has TeX inserts for typeset labels
" verbatimtex, btex, and etex will be treated as keywords
syn match mpTeXbegin "\(verbatimtex\|btex\)"
syn match mpTeXend "etex"
syn region mpTeXinsert start="\(verbatimtex\|btex\)"hs=e+1 end="etex"he=s-1 \
contains=@texTop,mpTeXbegin,mpTeXend containedin=ALL keepend
[[Category:Text Editors]]

Navigation menu