Changes

Jump to navigation Jump to search
12,945 bytes added ,  06:57, 31 July 2023
m
< [[Text Editors]] | [[Related Programs]] >
httphttps://www.vim.org/
This page is about editing ConTeXt source in Vim, gVim, MacVim, NeoVim, and other Vim clones. Some of The page describes the described features are scripts available only in Vim v8.0.0047 0055 or later: they will be noted . 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. == Using ConTeXt in Vim == 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… (see <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>, 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</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 <tt>~/.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>/bin:%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> 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. When editing a chapter file, it is convenient to invoke <tt>:ConTeXt</tt>directly on it, rather than having to switch to the root file. A note on “magic line”can be added at the beginning of each chapter file, which specifies therelative path to the root file. For instance:  % !TEX root = ../MyRoot.tex Vim searches for the magic line in the first ten lines of the current buffer:if the magic line is found, the document specified by that line is typeset rather than theone in the current buffer. The root document does not have to be opened inVim. === Updating the syntax files === Vim includes syntax files generated by <tt>mtxrun</tt>. If you want to 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 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: * <tt>[[</tt>: jump to the previous start of subject, section, chapter, part, component, or product;* <tt>]]</tt>: jump to the next start of subject, section, chapter, part, component, or product;* <tt>[]</tt>: jump to the previous end of section, chapter, etc…;* <tt>][</tt>: jump to the next end of section, chapter, etc…;* <tt>[{</tt>: jump to the previous <tt>\start…</tt> or <tt>\setup…</tt> command;* <tt>]}</tt>: jump to the next <tt>\stop…</tt> or <tt>\setup…</tt> command; Each of the above accepts an optional count. For example, you may type <tt>3[{</tt> to jumpthree <tt>\start…</tt> commands before. You may use the following ConTeXt-specific text objects, to be used in Visual or Operator-pending mode(see <tt>:help text-objects</tt>): * <tt>i$</tt>: inside <tt>$…$</tt> (dollars excluded);* <tt>a$</tt>: around <tt>$…$</tt> (dollars included);* <tt>tp</tt>: a ConTeXt paragraph. So, for example, you may copy (“yank” in Vim's jargon) a paragraph by typing <tt>ytp</tt> (“yank a TeXparagraph“), delete it with <tt>dtp</tt>, select it with <tt>vtp</tt>, reflow it with <tt>gqtp</tt>, etc…Similarly, you may yank a formula with <tt>vi$</tt> (or <tt>va$</tt>), and delete it, select it, etc…, in asimilar fashion. 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 <tt>\stop…</tt> commands, or betweenmatching parentheses. You may jump to a different file by positioning the cursor over the file name and typing <tt>gf</tt> (<tt>:help gf</tt>).For example, if you have the following in your document: \component my_componentputting the cursor over <tt>my_component</tt> and pressing <tt>gf</tt> will open <tt>my_component.tex</tt>. Similarly, you may use <tt>[<c-i></tt> (this is square bracket followed by ctrl-i)to jump to the definition of the word under the cursor (even if it is in a differentfile), or <tt>[i</tt> to display the (first line of the) definition under the status line. For these and similar commands,see <tt>:help include-search</tt>. Vim searches for files in the locations specified by the <tt>path</tt> option. You mayneed to adjust the value of <tt>path</tt> for the above to work (see <tt>:help 'path'</tt>). === Integration with MetaPost === Vim offers excellent support for editing METAFONT and MetaPost documents (<tt>mf</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,such as <tt>\startMPpage… \stopMPpage</tt>. 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. === Integration with other languages === 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>. You may embed other filetypes. Just define <tt>g:context_include</tt> (or <tt>b:context_include</tt> forbuffer-specific settings). For example, if you want to highlight C++ code inside, say, <tt>\startCPP… \stopCPP</tt>,define: let g:context_include = { 'cpp' : 'CPP' }The key is the name of the filetype and the corresponding value is name of the command. === 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>):  runtime/autoload/context.vim runtime/autoload/contextcomplete.vim runtime/compiler/context.vim runtime/ftplugin/{context,mf,mp}.vim runtime/indent/{context,mf,mp}.vim runtime/syntax/{context,mf,mp}.vim <b>Note:</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! If you get the following error when you open a ConTeXt or MetaPost document:  E410: Invalid :syntax subcommand: iskeyword edit the syntax files and remove the <tt>syn iskeyword</tt> or <tt>syntax iskeyword</tt> line.Instead, put a corresponding command in <tt>~/.vim/after/ftplugin/context.vim</tt>:  setlocal iskeyword=@,48-57,a-z,A-Z,192-255 and in <tt>~/.vim/after/ftplugin/mp.vim</tt> for MetaPost:  setlocal iskeyword=@,_ Everything should work, at least with Vim 7.4. === TODO === * Some essential math support.* 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/? == 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>.
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>:
so the next time you open a <tt>*.tex</tt> file, Vim will always recognize it as a ConTeXt document.
== A note on spell Spell checking ==
Vim 7 or later has a built-in spell checker. To enable it or disable it, use:
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.
== Using ConTeXt in Vim Powerful key mappings ==
Nikolai Weibull was In the first one who wrote following, <tt><leader></tt> denotes your “leader” (<tt>context:help mapleader</tt>), that is,the prefix for user-defined mappings.vimBy 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> files and submitted them to : map <leader> ,Rather than overriding the official Vim repositorydefault leader, you may define an alternative key.The <tt><space></tt> is a goodThey are part of choice, because by default it has the same function as the official Vim 7<tt><right></tt> key, and were expanded and improved in Vim 8.it is comfortable to type: map <space> <leader> " Use <space> as an alternative leader (backslash can still be used)
<b>If you feel that something is missing, please contribute!</b>=== Clean up auxiliary files ===
Information about providing feedback is 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 the header of the scriptsglob(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.
=== Typesetting ===The following mapping allows you to remove auxiliary files by pressing <tt>\tc</tt>: nnoremap <silent><buffer> <leader>tc :<c-u>call ConTeXtClean()<cr>
The recommended way to typeset a ConTeXt document is to use the <tt>:ConTeXt</tt> command. Just type: :ConTeXtto typeset the document in the current buffer. Typesetting happens in the background if you are using Vim 8.0.0047 or later,so you may continue working on your document. If there are errors, the quickfix window opens automaticallyto show the errors (one error per line). The cursor stays in the main document, so your typing workflow is notdisrupted. You may use standard quickfix commands to jump between errors: <tt>:cfirst</tt>, <tt>:cprev</tt>,<tt>:cnext</tt>, etc… (see <tt>:help quickfix</tt>). 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>=v:count1<cr>cprevious<cr>zzOr install Tim Pope's <i>unimpaired</i> plugin.= Snippets ===
If your document is typeset without errors, Vim allows you to define abbreviations for frequently used pieces of text (see <tt>Success!:help abbreviations</tt> is printed at the bottom of the screen).Here are a few examples:<pre>fun! Eatchar(pat) " See :help abbreviations let c = nr2char(getchar(0)) return (c =~ a:pat) ? '' : cendfun
The iab <ttbuffer>:ConTeXtch- \startchapter[title={</ttc-o> 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 ma}]<ttcr>:ConTeXtJobStatus</ttc-o>, and you may stop allrunning jobs with mb<ttcr>:ConTeXtStopJobs\stopchapter</ttesc> (these commands are available only in Vim 8.0.0047 or later). An alternative way to typeset `a document is to use `b<ttc-o>:makea</ttc-r>. Make sure that the current workingdirectory is set to the path to the file you want to compile =Eatchar(set with '\s')<ttcr>:lcd …iab </ttbuffer>), and type: :makeIf a s- \startsection[title={<ttc-o>Makefilema}]</ttcr> is present in the working directory, it will be used (you may<ttc-o>let g:context_ignore_makefile=1mb</ttcr> to ignore it). Otherwise, \stopsection<ttesc>mtxrun`a`b</ttc-o> willbe invoked directly. Note that a<ttc-r>:make=Eatchar('\s')</ttcr> always performs synchronous typesetting. Also, if there areerrors, the quickfix list is populated, but you have open it manually with iab <ttbuffer>:copenss- \startsubsection[title={</ttc-o>. It is recommended that you map the above commands. For example, you may add nnoremap ma}]<silent> <leadercr>tt :<c-uo>updatemb<cr>:ConTeXt\stopsubsection<cresc>to your `a`b<ttc-o>.vimrca</ttc-r>, or =Eatchar(better'\s')<cr> nnoremap iab <buffer> sss- \startsubsubsection[title={<silentc-o> ma}]<leadercr>tt :<c-uo>updatemb<cr>:ConTeXt\stopsubsubsection<cresc>to `a`b<ttc-o>~/.vim/after/ftplugin/context.vima</tt>, after which pressing <ttc-r>=Eatchar('\tts')</ttcr> (where iab <ttbuffer>slide- \startslide[title={</ttc-o> is your leader key) will save (if necessary) and compile the file. You may customize the path to the ma}]<ttcr>mtxrun</ttc-o> executable by setting mb<ttcr>g:context_mtxrun\stopslide</ttesc>.For example, if you want to use your ConTeXt Beta installation at `a`b<ttc-o>~/Applications/ConTeXta<c-Beta</ttr>,and you are using macOS, you may set the variable as follows: let g:context_mtxrun = Eatchar('PATH=$HOME/Applications/ConTeXt-Beta/tex/texmf-osx-64/bin:$PATH mtxrun\s')<cr> You may decide whether to use synctex or not by setting the iab <buffer> fig- \startplacefigure<ttcr>g:context_synctex</tttab> flag to \externalfigure[<ttc-o>1ma]%</ttcr> or []<ttc-o>0mb</ttcr>,respectively. For example: let g:context_synctex = 1 You may pass <ttc-d>mtxrun\stopplacefigure</ttesc> additional options by putting them in `a`b<ttc-o>g:context_extra_optionsa</ttc-r>.For example: let g:context_extra_options = Eatchar('--arrange --autopdf\s')<cr>The iab <ttbuffer>item--autogenerate\startitemize</ttcr>, <ttcr>--nonstopmode\stopitemize</ttup> and <tttab>--synctex\itemiab </ttbuffer> options are always included in thecommand. Finally, for each of the above variables, a corresponding bufferenum-local variable with the same name may be defined,whose value takes precedence over the global value. == Other useful vim plugins == * autocomplete: http://vim.sourceforge.net/scripts/script.php?script_id=182, almost undocumented, but life-saving* spell-checker: http://www.vim.org/scripts/script.php?script_id=499, but native spell-checking support is included in Vim 7 (see above). === TODO === * extract data from texweb and create syntax highlighting definitions for ConTeXt* some essential math support* proper URL highlighting ('%' doesn't start a comment, ...) \startitemize[request by VnPenguinn]* perhaps borrow something from http://vim-latex.sourceforge.net/? == 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 <codecr><cr>\stopitemize<up>~/.vim/ftplugin/latex-suite</codetab>). Copy this file to \itemiab <codebuffer>~/.vim/ftplugin/tex/texrci- \item</codepre>
2. Open this copy in your favorite editor (vim comes Type the abbreviation followed by Space to mind..expand the snippet, then continue typing normally.)
3Inside the definition of an abbreviation, marks may be set (see <tt>:h m</tt>), which allow you to jump between the differentparts of a snippet with TAB (CTRL-i) and CTRL-O (in Normal mode) after the abbreviation is expanded (see <tt>:h jump-motions</tt>). After line 80 in this fileFor example, after typing <tt>ch- </tt>, there is a series of "Compiler rulesthe cursor will be at the title's position." Just add this line If you press <tt><esc><tab></tt> (or<tt><c-o><tab></tt> if you want to stay in Insert mode after the section:jump), you will jump between <tt>\startchapter</tt>and <tt>\stopchapter</tt>.
TexLet g:Tex_CompileRule_cont = 'texexec == Buffer-local Insert-pdf --nonstopmode $*'mode macros to speed up editing ===
This will add compilation for ConTeXT(By [[User:David antos|D.A. In order to use it]] 19:52, 8 Jul 2005 (CEST))
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'
 
== Powerful key mappings ==
 
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>
==key = Key mappings borrowed from sciteSciTE ===If you use the stand-alone distribution for windows/Linux.You can reset the key mappingto speed ConTeXt compiling.
just If you use the stand-alone distribution for Windows/Linux.You can reset the key mapping to speed ConTeXt compiling. 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.
== MetaPost extension Other useful Vim plugins ==
Should highlight the syntax between <code>btex/verbatimtex</code> ... <code>etex</code> as TeX.=== Autocompletion ===
This doesn't work 100% Vim offers a rich completion mechanism (problems with commands inside comments<tt>:help ins-completion</tt>): If anyone knows how to repair , but there are several pluginsthatimprove on it, please do so. It would be nice if this would have landed in the official metapost syntax highlighting script for vim one day.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. === UltiSnips === UltiSnips[https://github.com/SirVer/ultisnips] is a sophisticated snippets manager.Here are a few examples of useful UltiSnips snippets for ConTeXt:  snippet "s(tart)?" "start / stop" br \start${1:something}$2 ${3:${VISUAL}} \stop$1 endsnippet snippet enum "Enumerate" b unlet \startitemize[n] \item ${0:${VISUAL}} \stopitemize endsnippet snippet item "Itemize" b \startitemize \item ${0:current_syntax${VISUAL}} \stopitemize endsnippet syn include @texTop syntax/tex.vim snippet it " MetaPost has TeX inserts for typeset labelsIndividual item" b \item ${0:${VISUAL}} endsnippet snippet fig " verbatimtexExternal 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, btexwhich 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 etex will be treated as keywordspaste the following:  --langdef=context syn match mpTeXbegin "--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>*(verbatimtex.+)\}/\. \1/s,section/ --regex-context=/^<nowiki>[[</nowiki>:space:<nowiki>]]</nowiki>*\\|btexstartsubsection<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/ syn match mpTeXend "etex"--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/ syn region mpTeXinsert start--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>*(verbatimtex.+)\|btex}/\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>*(.+)"hs\}/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>*=e<nowiki>[[</nowiki>:space:<nowiki>]]</nowiki>*\{<nowiki>[[</nowiki>:space:<nowiki>]]</nowiki>*(.+)\}/\1 end/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 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 "etextexrc"he(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-1 files, save the changes; when you want to compile, switch to normal mode and just type <code>\ll</code> (that's '' 'backslash el el' '') contains=@texTopVoila,mpTeXbegincompilation 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,mpTeXend containedinyou should have this line in your texrc:  TexLet g:Tex_DefaultTargetFormat =ALL keepend'cont'
{{Installation navbox}}
[[Category:Text Editors]]

Navigation menu