New vim d.vim syntax highlighting script

Jason Mills jmills at cs.mun.ca
Mon Mar 13 12:14:46 PST 2006


David Ferenczi wrote:
> Thank you very much for your work!
> 
> Recently I was playing around a bit with the d.vim script trying to get some
> features work. I didn't have much time, and so were the results, as well.
> Since I'm not familiar with vim scripts my assumptions and additions may be
> totally wrong.
> 
> 1. Highlighting operators:
> I saw the operator names in the script, thus I presumed that the operators
> should have also been highlighted, but somehow it didn't work for me. So I
> added a quick and dirty hack:

The option you are talking about is d_hl_operator_overload. When set to 
true, the specially named class member functions that implement the 
operators are highlighted (e.g. opNeg), not the operator the method 
refers to (e.g. - ).

> ---------8<----------------------------
> " Operators
> syn match dOperator             "[~+!%\/=\(\)\[\]\<\>&\{\},?;.:\-\*]"
> ---------8<----------------------------
> 
> I know it's quite far from elegant, but it worked - at least - for me.

I will add this, or some variant of it, in the next update. Most likely 
I'll provide an option to enable to disable operator highlighting.

> Could you please give me a short explanation how the operator highlighting
> is intended to work?

See my first comment.

> 2. Highlighting function names:
> I was thinking about how to implement, and also look at other scripts to get
> some ideas, but most likely the learning curve cannot be avoided in this
> case. ;-) A tip could be useful though, how the correct implementation
> would look like.

I'm afraid I'm not a vim syntax script expert either. So, I can't offer 
much in the way of tips. Implementing this would be a learning 
experience for me as well. Nevertheless, I will look into implementing 
some sort of method name highlighting for the next update.

What type of support would you like to see? Here are some options:

1. Highlight only class method names in the class definition. This is 
relatively easy.
2. Highlight method and function names where used. This maybe difficult. 
Do you know of any languages where vim highlights the method/function names?


Jason



More information about the Digitalmars-d-announce mailing list