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 scratch.


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/).


If your question is of interest to others as well, please add an entry to the 

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net

Reply via email to