New vim d.vim syntax highlighting script

David Ferenczi raggae at ferenczi.net
Tue Mar 14 11:56:19 PST 2006


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

Thank you very much, now I understand.

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

I'm glad if I could contribute some.

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

Th first one would be essential, the socond rather nice to have.

> Do you know of any languages where vim highlights the method/function
> names?

I searched for it, and there were many scripts with a "Function" keyword
defined. I didn't have the time to go through the list, I tried to pick up
some languages, which I know. Python seemed to be a good example for
impelementing the first type of function name highlighting, and since
sometimes I use Python, I can also confirm that it works.

David







More information about the Digitalmars-d-announce mailing list