[NTG-context] vim syntax highlighting in MKIV

Aditya Mahajan adityam at umich.edu
Sun Jun 27 07:41:35 CEST 2010

On Sat, 26 Jun 2010, Aditya Mahajan wrote:

> Almost all the errors in t-vim over the years have due to trying to support 
> kpse: directive. (The errors were not a fault of ConTeXt, but the way quotes 
> are handled by cmd.exe and the various shells in *nix. I still haven't 
> figured out a syntax that works with all shells). This makes me wonder 
> whether it was a good idea to make vim module work out of the box. Perhaps a 
> more robust alternative was to ask the uses to copy 2context.vim to 
> $HOME/.vim/scripts/ and forget about getting mtxrun to locate the file. What 
> do others think?

In the spirit of MkIV, I have attempted to redo the vim module from 


Download t-vim.tex t-filter.tex and 2context.vim. For testing just place 
them in the current directory.

This new version is delegates the task of creating external files and 
running vim to get syntax highlighting to t-filter. It reads the file 
under a restrictive catcode regime... so 2context.vim only has to escape a 
few characters: \ { }, everything else has a catcode other (except space 
and newline which are active).

Currently, this new module only supports

* syntax highlighting (syntax=filetype)

* two color schemes (alternative=pscolor and alternative=blackandwhite)

* specifying start and stop lines (start=... , stop=...)

An additional feature is that the module stores the md5 sums of all files, 
and runs vim only if the file has changed. So, this should be 
significantly faster than the old module.


* No \typevimfile... instead \definevimtyping[whatever] creates a command
\typewhateverfile that can be used as

* Currently, no support for line numbering, although that should be easy 
to add now.

* No support for active spaces yet.

* Most importantly, this only runs under MkIV. That is because 
\doprocesslocalsetups is not defined in MkII.

Hans, can you add the definition of \doprocesslocalsetups to MkII?

I have only tested on linux. Testing on other platforms will be 
appreciated (Just run the files under test/vim/).


More information about the ntg-context mailing list