ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* TeX + Metapost syntax highlighting in Vim
@ 2005-07-08 16:10 Mojca Miklavec
  2005-07-08 17:48 ` Thomas A. Schmitz
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Mojca Miklavec @ 2005-07-08 16:10 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 1189 bytes --]


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

[-- Attachment #2: context.vim --]
[-- Type: text/plain, Size: 3074 bytes --]

" Vim syntax file
" Language:	   ConTeXt
" Maintainer:  Mojca Miklavec <mojca.miklavec@guest.arnes.si>
" 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 contains=@metafunTop
" 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 contains=@metafunTop
syn region metafunBlock matchgroup=metafunDelim start=#\\startMPgraphic# end=#\\stopMPgraphic# keepend contains=@metafunTop
syn region metafunBlock matchgroup=metafunDelim start=#\\startuseMPgraphic# end=#\\stopuseMPgraphic# keepend contains=@metafunTop
syn region metafunBlock matchgroup=metafunDelim start=#\\startreusableMPgraphic# end=#\\stopreusableMPgraphic# keepend contains=@metafunTop
syn region metafunBlock matchgroup=metafunDelim start=#\\startuniqueMPgraphic# end=#\\stopuniqueMPgraphic# keepend contains=@metafunTop
syn region metafunBlock matchgroup=metafunDelim start=#\\startMPrun# end=#\\stopMPrun# keepend contains=@metafunTop

" 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 contains=@javascriptTop
syn region javascriptBlock matchgroup=javascriptDelim start=#\\startJSpreamble# end=#\\stopJSpreamble# keepend contains=@javascriptTop


hi link metafunDelim texSTatement
hi link javascriptDelim texSTatement

let b:current_syntax = "context"

" vim: set ts=4 sw=4:

[-- Attachment #3: Type: text/plain, Size: 139 bytes --]

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: TeX + Metapost syntax highlighting in Vim
  2005-07-08 16:10 TeX + Metapost syntax highlighting in Vim Mojca Miklavec
@ 2005-07-08 17:48 ` Thomas A. Schmitz
  2005-07-08 22:14   ` VnPenguin
  2005-07-14 14:50   ` Christopher Creutzig
  2005-07-08 17:53 ` Hans Hagen
  2005-07-08 21:28 ` Nikolai Weibull
  2 siblings, 2 replies; 12+ messages in thread
From: Thomas A. Schmitz @ 2005-07-08 17:48 UTC (permalink / raw)


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 <mojca.miklavec@guest.arnes.si>
> " 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 contains=@metafunTop
> " 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  
> contains=@metafunTop
> syn region metafunBlock matchgroup=metafunDelim start=#\ 
> \startMPgraphic# end=#\\stopMPgraphic# keepend contains=@metafunTop
> syn region metafunBlock matchgroup=metafunDelim start=#\ 
> \startuseMPgraphic# end=#\\stopuseMPgraphic# keepend  
> contains=@metafunTop
> syn region metafunBlock matchgroup=metafunDelim start=#\ 
> \startreusableMPgraphic# end=#\\stopreusableMPgraphic# keepend  
> contains=@metafunTop
> syn region metafunBlock matchgroup=metafunDelim start=#\ 
> \startuniqueMPgraphic# end=#\\stopuniqueMPgraphic# keepend  
> contains=@metafunTop
> syn region metafunBlock matchgroup=metafunDelim start=#\ 
> \startMPrun# end=#\\stopMPrun# keepend contains=@metafunTop
>
> " 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 contains=@javascriptTop
> syn region javascriptBlock matchgroup=javascriptDelim start=#\ 
> \startJSpreamble# end=#\\stopJSpreamble# keepend  
> contains=@javascriptTop
>
>
> 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
>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: TeX + Metapost syntax highlighting in Vim
  2005-07-08 16:10 TeX + Metapost syntax highlighting in Vim Mojca Miklavec
  2005-07-08 17:48 ` Thomas A. Schmitz
@ 2005-07-08 17:53 ` Hans Hagen
  2005-07-08 21:32   ` Nikolai Weibull
  2005-07-08 21:28 ` Nikolai Weibull
  2 siblings, 1 reply; 12+ messages in thread
From: Hans Hagen @ 2005-07-08 17:53 UTC (permalink / raw)


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.

What is the syntax? I can exten ctstools to spit out a vim keyword table; it 
already handles scite, jedit and bbedit so adding vim is not undoable

Hans


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: TeX + Metapost syntax highlighting in Vim
  2005-07-08 16:10 TeX + Metapost syntax highlighting in Vim Mojca Miklavec
  2005-07-08 17:48 ` Thomas A. Schmitz
  2005-07-08 17:53 ` Hans Hagen
@ 2005-07-08 21:28 ` Nikolai Weibull
  2005-07-14 19:19   ` VnPenguin
  2 siblings, 1 reply; 12+ messages in thread
From: Nikolai Weibull @ 2005-07-08 21:28 UTC (permalink / raw)


Mojca Miklavec wrote:

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

Hi!

I don't want to be a party-pooper, but I have already commited support
for the context file-type to vim7 CVS.  Perhaps you can look over my
version and make suggestions?  It doesn't use the rather bloated
LaTeX/Plain TeX syntax definition, but my own blend,
        nikolai

-- 
Nikolai Weibull: now available free of charge at http://bitwi.se/!
Born in Chicago, IL USA; currently residing in Gothenburg, Sweden.
main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: TeX + Metapost syntax highlighting in Vim
  2005-07-08 17:53 ` Hans Hagen
@ 2005-07-08 21:32   ` Nikolai Weibull
  2005-07-12 13:38     ` Mojca Miklavec
  0 siblings, 1 reply; 12+ messages in thread
From: Nikolai Weibull @ 2005-07-08 21:32 UTC (permalink / raw)


(Sorry for responding to two separate mails, I'm a bit rushed, going on
a three-day holiday.)

Hans Hagen wrote:

> Mojca Miklavec wrote:

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

That's a great idea, I'll add that to my version

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

Version 7 has a spell-checker built in.

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

There's always the ever-simple CTRL-P/CTRL-N as well.

> What is the syntax? I can exten ctstools to spit out a vim keyword table; 
> it already handles scite, jedit and bbedit so adding vim is not undoable

Download vim and run :help syntax.  But the short version is

syn keyword contextKeyword  ...
            ^-- group name  ^-- keywords

But that won't work for stuff beginning with \\.  Then you'll have to
use regexes and

syn match   contextKeyword  ...
                            ^-- regex

Exactly what kind of keyword table are we talking about?,
        nikolai

-- 
Nikolai Weibull: now available free of charge at http://bitwi.se/!
Born in Chicago, IL USA; currently residing in Gothenburg, Sweden.
main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: TeX + Metapost syntax highlighting in Vim
  2005-07-08 17:48 ` Thomas A. Schmitz
@ 2005-07-08 22:14   ` VnPenguin
  2005-07-14 14:50   ` Christopher Creutzig
  1 sibling, 0 replies; 12+ messages in thread
From: VnPenguin @ 2005-07-08 22:14 UTC (permalink / raw)


On 7/8/05, Thomas A. Schmitz <thomas.schmitz@uni-bonn.de> wrote:
> 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

I use vim everyday here with ConTeXt for vietnamese text :-)
It's nice to have a set of macros/mapping for ConTeXt some where so
vim's fans could share & enjoy with ...

-- 
http://vnoss.org
Vietnamese Open Source Software Community

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: TeX + Metapost syntax highlighting in Vim
  2005-07-08 21:32   ` Nikolai Weibull
@ 2005-07-12 13:38     ` Mojca Miklavec
  0 siblings, 0 replies; 12+ messages in thread
From: Mojca Miklavec @ 2005-07-12 13:38 UTC (permalink / raw)


Nikolai Weibull wrote:

> I don't want to be a party-pooper, but I have already commited support
> for the context file-type to vim7 CVS.  Perhaps you can look over my
> version and make suggestions?

That's great! I didn't know that. Some time ago some people were
asking about ConTeXt support for vim, but I don't remember any
responses.

I like the "contains=@NoSpell" syntax and there are much more
highlights in your code.

Quite some pieces of code can still be added of course, but writing a
good syntax highlighting scheme may become almost as is almost as
tricky as writing a compiler for it :)

\title, \subject, ... can be added
Maybe some more extensive support for math as well ...

> It doesn't use the rather bloated LaTeX/Plain TeX syntax definition,
> but my own blend,

Probably the opinions on what "bloated" means differ at that point. I
find it very useful if wrong brackets or any other suspicious code is
marked as an error before the compiler has to tell me that (and for an
unexperienced user it is very difficult to find such a mistake from
compiler messages). I'm very glad that your code got rid of LaTeX
commands, but I find it great if we keep extending the code.

Moreover, I even wanted to have command-specific code highlighting.
ConTeXt has a big advantage over LaTeX: the central development. So
theoretically it would be possible to highlight any known command
different as the unknown (user-defined or misspelled) ones. PostScript
syntax highlighting script in vim does exactly that for example.

I wanted to suggest to make a cont-en.vim (cont-nl.vim, ..., maybe
also tex-plain.vim) file with all the known ConTeXt commands. I don't
know vim that well. I can imagine that this would cause some problems
on slower machines, but including it would only be left as an option.

> (Sorry for responding to two separate mails, I'm a bit rushed, going on
> a three-day holiday.)
> 
> Hans Hagen wrote:
> 
> > Mojca Miklavec wrote:
> 
> > > If you have something like
> > > \startMPpage
> > > draw ...
> > > \stopMPpage,
> > > it will do the syntax highligting for metapost inside the \start-\stop
> > > pair.
> 
> That's a great idea, I'll add that to my version

I made some corrections to it (off-list), but it is still far away
from being perfect. If you know how to correct some pecculiarities
mentioned in the comments, please do so and then adapt the code to fit
into your highlighting script.

It would be great if someone could give some hints about which
commands switch the mode of typesetting:

- startformula ... \stopformula
- startbuffer ... \stopbuffer (I would highlight the content for
"buffer" as a string)
- \start???MP??? ...\stop???MP???
- start???XML??? ... \stop???XML???

> Version 7 has a spell-checker built in.

I noticed that. But I suppose I'll wait for an official version of Vim
to come out. "contains=@NoSpell" should probably also be added to
mp.vim and mf.vim.

> > > 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.
> 
> There's always the ever-simple CTRL-P/CTRL-N as well.

I just noticed that autocomplete is in no way as clever as
syntax-highlighting is. It would be great if there would exist a
similar support as the one for Java in Eclipse (only the keywords that
make sense in the current context are offered for autocompletion). An
example would be: if someone writes
    \adaptlayout[<ctrl-something>
only the options height= and lines= would be offered.
But at that point I have to answer to myself: "dream on!" It is
probably possible, but too complex at this moment.

> > What is the syntax? I can exten ctstools to spit out a vim keyword table;
> > it already handles scite, jedit and bbedit so adding vim is not undoable
> 
> Download vim and run :help syntax.  But the short version is
> 
> syn keyword contextKeyword  ...
>             ^-- group name  ^-- keywords
> 
> But that won't work for stuff beginning with \\.  Then you'll have to
> use regexes and
> 
> syn match   contextKeyword  ...
>                             ^-- regex
> 
> Exactly what kind of keyword table are we talking about?,

My most optimistic version: [all] of the commands defined in ConTeXt
(see also the comments above), together with some additional checking
if \start-s have their corresponding \stop-s and if parameters in the
brackets are applicable for the command they belong too.
    \adaptlayout[lines=30,somestupidparameter=1]
would thus highlight the valid "lines=" different from "somestupidparameter=1"
    \setupblackrules[alternative=c]
would mark "c" as invalid (only a and b are possible).

And already the first obstacle I came across: How can I define a
regexp matching the
    [ ... ]
area? Note that \firstcommand[ command={\secondcommand[x]}, text=$]$ ]

Quite some work to do ... but perhaps doable one day unless Vim is too
slow to process all that. No other highlighting script is as huge is
this one would be.


The first and most primitive step towards this is (as Nikolai wrote)
simply listing:
syn match   contextKeyword  ...
                            ^-- regex
for every ConTeXt command.
mf.vim and mp.vim are both defined that way. They only highlight the
keywords, they don't care about the syntax.

Mojca

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: TeX + Metapost syntax highlighting in Vim
  2005-07-08 17:48 ` Thomas A. Schmitz
  2005-07-08 22:14   ` VnPenguin
@ 2005-07-14 14:50   ` Christopher Creutzig
  2005-07-14 16:16     ` Thomas A. Schmitz
  1 sibling, 1 reply; 12+ messages in thread
From: Christopher Creutzig @ 2005-07-14 14:50 UTC (permalink / raw)


Thomas A. Schmitz wrote:

> 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 

  Not wishing to discredit vim, I'd still like to ask what is missing 
with the solution presented at www.emacswiki.org/cgi-bin/wiki/LineNumbers


regards,
	Christopher

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: TeX + Metapost syntax highlighting in Vim
  2005-07-14 14:50   ` Christopher Creutzig
@ 2005-07-14 16:16     ` Thomas A. Schmitz
  0 siblings, 0 replies; 12+ messages in thread
From: Thomas A. Schmitz @ 2005-07-14 16:16 UTC (permalink / raw)



[-- Attachment #1.1: Type: text/plain, Size: 779 bytes --]


On Jul 14, 2005, at 4:50 PM, Christopher Creutzig wrote:

> Thomas A. Schmitz wrote:
>
>
>> 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
>>
>
>  Not wishing to discredit vim, I'd still like to ask what is  
> missing with the solution presented at www.emacswiki.org/cgi-bin/ 
> wiki/LineNumbers
>
>
> regards,
>     Christopher

I've tried setnu.el, setnu+.el (or somesuch), and as soon as you add  
lines in the midst of a paragraph and then make emacs refill the  
paragraph, line numbers will not work anymore. It's especially  
annoying when you yank a number of lines into a paragraph. That's  
wrong with this solution. Vim is impeccable in this regard.

Best

Thomas

[-- Attachment #1.2: Type: text/html, Size: 2446 bytes --]

[-- Attachment #2: Type: text/plain, Size: 139 bytes --]

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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: TeX + Metapost syntax highlighting in Vim
  2005-07-08 21:28 ` Nikolai Weibull
@ 2005-07-14 19:19   ` VnPenguin
  2005-07-15 16:01     ` Nikolai Weibull
  2005-09-24 21:41     ` Nikolai Weibull
  0 siblings, 2 replies; 12+ messages in thread
From: VnPenguin @ 2005-07-14 19:19 UTC (permalink / raw)


On 7/8/05, Nikolai Weibull
<mailing-lists.context-users@rawuncut.elitemail.org> wrote:
> Mojca Miklavec wrote:
> 
> > In case someone finds this experimental piece of code for highlighting
> > metapost inside ConTeXt useful, put:
> 
> Hi!
> 
> I don't want to be a party-pooper, but I have already commited support
> for the context file-type to vim7 CVS.  Perhaps you can look over my
> version and make suggestions?  It doesn't use the rather bloated
> LaTeX/Plain TeX syntax definition, but my own blend,
>         nikolai

Hi,
Just tested your context.vim under vim 6.3.x; It's better than
tex/latex standard syntax in vim 6.3 IMHO.

I have only a small remark: The following code is valid in ConTeXt:

\useURL [book-ns-openssl][http://www.amazon.com/exec/obidos/ASIN/059600270X/qid%3D1024342376/103-8123753-9606263][][Network
Security with OpenSSL]

but the syntax considers % like a comment mark, so I see another color
for the text after %.
It's possible to make the comment pattern smarter ? :)


Thank you,
-- 
http://vnoss.org
Vietnamese Open Source Software Community

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: TeX + Metapost syntax highlighting in Vim
  2005-07-14 19:19   ` VnPenguin
@ 2005-07-15 16:01     ` Nikolai Weibull
  2005-09-24 21:41     ` Nikolai Weibull
  1 sibling, 0 replies; 12+ messages in thread
From: Nikolai Weibull @ 2005-07-15 16:01 UTC (permalink / raw)


VnPenguin wrote:

> Just tested your context.vim under vim 6.3.x; It's better than
> tex/latex standard syntax in vim 6.3 IMHO.

Great, thanks!

> I have only a small remark: The following code is valid in ConTeXt:
> 
> \useURL [book-ns-openssl][http://www.amazon.com/exec/obidos/ASIN/
>       059600270X/qid%3D1024342376/103-8123753-9606263][][Network
>       Security with OpenSSL]

> but the syntax considers % like a comment mark, so I see another color
> for the text after %.
> It's possible to make the comment pattern smarter ? :)

Hm, probably not.  The problem with TeX is that it's so goddam flexible
when it comes to "syntax".  The whole deal with turning $ on and off, %
into something else, and so on is really hard to capture in a syntax
highlighter.  To do so successfully, the highlighter would more or less
have to parse the TeX document itself to understand when and where to do
what.  I guess special cases like the one above (with a very weird URL
indeed) so that \useURL would be parsed differently, but it's impossible
to always get these things right,
        nikolai

-- 
Nikolai Weibull: now available free of charge at http://bitwi.se/!
Born in Chicago, IL USA; currently residing in Gothenburg, Sweden.
main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: TeX + Metapost syntax highlighting in Vim
  2005-07-14 19:19   ` VnPenguin
  2005-07-15 16:01     ` Nikolai Weibull
@ 2005-09-24 21:41     ` Nikolai Weibull
  1 sibling, 0 replies; 12+ messages in thread
From: Nikolai Weibull @ 2005-09-24 21:41 UTC (permalink / raw)


(OK, this is old, but I finally did something about it.)

VnPenguin wrote:

> Just tested your context.vim under vim 6.3.x; It's better than
> tex/latex standard syntax in vim 6.3 IMHO.
> 
> I have only a small remark: The following code is valid in ConTeXt:
> 
> \useURL [book-ns-openssl][http://www.amazon.com/exec/obidos/ASIN/059600270X/qid%3D1024342376/103-8123753-9606263][][Network
> Security with OpenSSL]
> 
> but the syntax considers % like a comment mark, so I see another color
> for the text after %.  It's possible to make the comment pattern
> smarter ? :)

Actually, yes, there is.  Wait for me to get a new version sent upstream
to the Vim 7 CVS, add the following to your vimrc, and cheer:

let g:context_spacious_comments = 1

This will make it so that comments must be at the beginning of the line
or be preceded by a white-space,
        nikolai

-- 
Nikolai Weibull: now available free of charge at http://bitwi.se/!
Born in Chicago, IL USA; currently residing in Gothenburg, Sweden.
main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2005-09-24 21:41 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-08 16:10 TeX + Metapost syntax highlighting in Vim Mojca Miklavec
2005-07-08 17:48 ` Thomas A. Schmitz
2005-07-08 22:14   ` VnPenguin
2005-07-14 14:50   ` Christopher Creutzig
2005-07-14 16:16     ` Thomas A. Schmitz
2005-07-08 17:53 ` Hans Hagen
2005-07-08 21:32   ` Nikolai Weibull
2005-07-12 13:38     ` Mojca Miklavec
2005-07-08 21:28 ` Nikolai Weibull
2005-07-14 19:19   ` VnPenguin
2005-07-15 16:01     ` Nikolai Weibull
2005-09-24 21:41     ` Nikolai Weibull

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).