[NTG-context] Making a verbatim file for another language

Aditya Mahajan adityam at umich.edu
Thu Dec 28 18:09:57 CET 2006


On Thu, 28 Dec 2006, cormullion at mac.com wrote:

> On 2006-12-27, at 21:41.0, Aditya Mahajan wrote:
> 
> > If you have vim and are interested in testing, you can be the first
> > tester of the module :)
> 
> Hi! Yes I can find a vim module, so if you can tell me which files to 
> put where, I'll give it a try!

I have attached the files. Please note that we are still playing 
around with the module, so certain features will change.

Right now, place t-vimsyntax.tex and 2context.vim files in the working 
directory. You need to have write18 enabled.

Add \usemodule[vimsyntax] on the top of your file. (And ofcourse,
\setupcolors[state=start])

1. If you want to typeset an existing file, and lets say the filetype 
(in vim's terms) is ruby. Then

\definetypeVIMfile [name of macro] %Usually typeRUBY, typeMATLAB, etc.
       [ % Optional arguments
        start=<linenumber>, %starting line number, defaults to 1
        stop=linenumber,    %stopping line number, defaults to 0,
                            %and 2context makes it end of file
        tab=<tabstop>,      %How many spaces should a tab mean,
                            %defaults to 8.
                            %Support for visible tab will be added.
        space=(yes|on|no)   %no ignores spaces, yes honors file spaces
                            %on makes spaces visible.
        vimcolorscheme=<colorscheme>, %Which vim colorscheme to use
                            %defaults to pscolor, which is the only
                            %scheme implemented so far.
       syntax=<syntax>,     %Which syntax highlighing to use in vim.
       ] % End of optional arguments

In the simplest case, you will have

\definetypeVIMfile [typeRUBY] [syntax=ruby] % tab and spaces to your preference

Then you can use

\typeRUBY [optional arguments, as above] {filename}
                                          %filename needs extension also

2. If you need to type code snippets

\defineVIMtyping  [RUBY]    [syntax=ruby] %Other options same as above

and then

\startRUBY
# This is a ruby program

puts "Hello World"
\stopRUBY


Let us know if you come across any problems.

Aditya
-------------- next part --------------
A non-text attachment was scrubbed...
Name: t-vimsyntax.tex
Type: application/octet-stream
Size: 9418 bytes
Desc: 
Url : http://www.ntg.nl/pipermail/ntg-context/attachments/20061228/e2e05115/attachment-0002.obj 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 2context.vim
Type: application/octet-stream
Size: 4717 bytes
Desc: 
Url : http://www.ntg.nl/pipermail/ntg-context/attachments/20061228/e2e05115/attachment-0003.obj 


More information about the ntg-context mailing list