Mojca,

just wonderful to see that there's another ConTeXt user who likes vim! Though I'm basically an emacs person, there are some editing tasks I like to do with vim - the line numbering alone is wonderful, there is no equivalent in emacs (and I've tried quite a lot of things!). So cheers to you. So far, I've basically been working with vim-latex, gnashing my teeth from time to time (oh the way they hijacked the alt key!). I've just added support for typesetting with texexec by adding this line to texrc:

TexLet g:Tex_CompileRule_cont = 'texexec --pdf --nonstopmode $*'

But I for one would be extremely happy if someone more knowledgeable would add proper ConTeXt support to vim the way Berend and Patrick added ConTeXt support to AucTeX!

Best

Thomas

On Jul 8, 2005, at 6:10 PM, Mojca Miklavec wrote:


In case someone finds this experimental piece of code for highlighting metapost inside ConTeXt useful, put:

  " ConTeXt
  augroup filetypedetect
    au! BufRead,BufNewFile *.tex    setfiletype context
  augroup END

somewhere to your filetype.vim (probably after TeX) and move the attached file to syntax\context.vim.

If you have something like
\startMPpage
draw ...
\stopMPpage,
it will do the syntax highligting for metapost inside the \start- \stop pair.

There are still some "bugs" present (see comments in file), but I don't know how yet to get rid of them.

I downloaded SpellChecker and SuperTab (autocomplete) today from the vim website and it works great! (see http://contextgarden.net/ Vim and feel free to add any useful stuff there)

I was astonished as I saw autocomplete work. There are only a couple of lines with an extraordinary functionality. I think that if someone writes a good script to convert texshow to vim syntax highlighting script, than autocomplete will be able to provide good hints for all the existing commands in ConTeXt and the corresponding parameters. I'll try to see what I can do, but please don't excpect any results too soon.

Mojca
" Vim syntax file
" Language:       ConTeXt
" Maintainer:  Mojca Miklavec <[EMAIL PROTECTED]>
" Installation:
" To automatilcally load this file when a .tex file is opened, add the
"    following lines to ~/.vim/filetype.vim:
"
"        augroup filetypedetect
"            au! BufRead,BufNewFile *.tex        setfiletype context
"        augroup END
"
" You will have to restart vim for this to take effect. In any case it " is a good idea to read ":he new-filetype" so that you know what is going
"    on, and why the above lines work.

"    Adapted from eruby by Michael Brailsford (Thanks for the idea!)
"
"    This is just a testing version.
"    TODO:
" - adapt tex.vim for plain TeX + ConTeXt support only (no LaTeX!!!)
"    - add MetaFun support on the top of Metapost
" - add all the possible \start ... \stop delimiters which switch the
"      syntax highlighting to MetaFun, XML, JavaScript, ...
"
if version < 600
    syntax clear
elseif exists("b:current_syntax")
    finish
endif

"Source the tex syntax file
runtime! syntax/tex.vim
"Set the filetype to tex to load the tex %??? ftplugins
set ft=tex
unlet b:current_syntax

" Put the metafun syntax file in @metafunTop
"
" TODO: should be changed to metafun once the support is there
" javascript should probably be adapted to PDF specification too, but it
" changes in every version anyway and doesn't work either
"
syn include @metafunTop syntax/mp.vim
" for some reason I can't make both metapost and javascript working at the same time
"syn include @javascriptTop syntax/javascript.vim

syn region metafunBlock matchgroup=metafunDelim start=#\ \startMPpage# end=#\\stopMPpage# keepend [EMAIL PROTECTED] " TODO: \startuseMPgraphic{the name} - "the name" has to be catched and
" typeset in ConTeXt, not in metapost!!!
" \start..MP.. may not be inside comments!!!
syn region metafunBlock matchgroup=metafunDelim start=#\ \startMPinclusions# end=#\\stopMPinclusions# keepend [EMAIL PROTECTED] syn region metafunBlock matchgroup=metafunDelim start=#\ \startMPgraphic# end=#\\stopMPgraphic# keepend [EMAIL PROTECTED] syn region metafunBlock matchgroup=metafunDelim start=#\ \startuseMPgraphic# end=#\\stopuseMPgraphic# keepend [EMAIL PROTECTED] syn region metafunBlock matchgroup=metafunDelim start=#\ \startreusableMPgraphic# end=#\\stopreusableMPgraphic# keepend [EMAIL PROTECTED] syn region metafunBlock matchgroup=metafunDelim start=#\ \startuniqueMPgraphic# end=#\\stopuniqueMPgraphic# keepend [EMAIL PROTECTED] syn region metafunBlock matchgroup=metafunDelim start=#\ \startMPrun# end=#\\stopMPrun# keepend [EMAIL PROTECTED]

" comments have to be added, \startJScode{name}, "name" has to be catched and
" typeset in ConTeXt, not in javascript
syn region javascriptBlock matchgroup=javascriptDelim start=#\ \startJScode# end=#\\stopJScode# keepend [EMAIL PROTECTED] syn region javascriptBlock matchgroup=javascriptDelim start=#\ \startJSpreamble# end=#\\stopJSpreamble# keepend [EMAIL PROTECTED]


hi link metafunDelim texSTatement
hi link javascriptDelim texSTatement

let b:current_syntax = "context"

" vim: set ts=4 sw=4:
_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context


_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

Reply via email to