Changes

Jump to navigation Jump to search
2,264 bytes added ,  20:02, 30 October 2016
no edit summary
http://www.vim.org/
[[File:context-in-vim.png]][https://asciinema.org/a/91111]
This page is about editing ConTeXt source in Vim, gVim, MacVim, NeoVim, and other Vim clones.
that improve on it, in particular, to provide automatic completion of keywords:
* µcomplete: [https://github.com/lifepillar/vim-mucomplete]* 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]
The asciicast at the top of this page uses µcomplete.
Vim allows you to define abbreviations for frequently used pieces of text (see <tt>:help abbreviations</tt>).
If you need more sophisticated support for snippets of code, UltiSnips[https://github.com/SirVer/ultisnips]
is the plugin to use. 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 \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 directly, 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=/^[[:space:]]*\\startsection[[:space:]]*\[[^]]*title[[:space:]]*=[[:space:]]*\{[[:space:]]*(.+)\}/\. \1/s,section/ --regex-context=/^[[:space:]]*\\startsubsection[[:space:]]*\[[^]]*title[[:space:]]*=[[:space:]]*\{[[:space:]]*(.+)\}/\.\. \1/s,subsection/ --regex-context=/^[[:space:]]*\\startsubsubsection[[:space:]]*\[[^]]*title[[:space:]]*=[[:space:]]*\{[[:space:]]*(.+)\}/\.\.\. \1/s,subsubsection/ --regex-context=/^[[:space:]]*\\startchapter[[:space:]]*\[[^]]*title[[:space:]]*=[[:space:]]*\{[[:space:]]*(.+)\}/\1/c,chapter/ --regex-context=/^[[:space:]]*\\startsubject[[:space:]]*\[[^]]*title[[:space:]]*=[[:space:]]*\{[[:space:]]*(.+)\}/SUBJ \1/c,subject/ --regex-context=/^[[:space:]]*\\startpart[[:space:]]*\[[^]]*title[[:space:]]*=[[:space:]]*\{[[:space:]]*(.+)\}/\1/p,part/ Put this in your <tt>vimrc</tt>: let g:tagbar_type_context = { \ 'ctagstype': 'context', \ 'kinds': [ \ 'p:parts', \ 'c:chapters', \ 's:sections', \ 'S:slides' \ ], \ 'sort': 0 \ } That's it! You may see an example of Tagbar in the asciicast at the top of this document.
=== Using LaTeX-Suite ===
134

edits

Navigation menu