On 07/11/08 08:08, François Ingelrest wrote:
> On Thu, Nov 6, 2008 at 22:41, Roberto Miura Honji<[EMAIL PROTECTED]>  wrote:
>> I'm using highlight inside a function and It's working.
>
> You get the same color highlighting inside and outside the function?
> For me the highlighting works inside functions for most statements,
> but not for the 'highlight' statement itself (see attached
> screenshot).
>
>> Do you call the function?
>> If you only define a function on foo.vim, this only will be defined. Try
>> append a follow line in a foo.vim: call Foo()
>
> This doesn't make a difference. Actually, I'm not sure the syntax file
> checks that functions are called to highlight them.

Yeah, looks like the syntax/vim.vim script doesn't recognise the same 
syntax groups for some statements when they are inside a function. With 
the default GUI colours, here's what I see:

line
     word        isolated (=> links to)      inside func (=> links to)
highlight Comment guifg=white guibg=black
     highlight   vimHighlight => Statement   vimIsCommand
     Comment     vimHiGroup => Type          vimIsCommand
     guifg       vimHiGuiFgBg => Type        vimIsCommand
     =           vimHiKeyList                vimOper => Statement
     white       vimHiGroup => Type          vimIsCommand
     guibg       vimHiGuiFgBg => Type        vimIsCommand
     =           vimHiKeyList                vimOper => Statement
     black       vimHiGroup => Type          vimIsCommand
syn sync fromstart
     syn         vimSyntax => Statement      vimIsCommand
     sync        vimSynType => Type          vimIsCommand
     fromstart   vimSyncC => Type            vimIsCommand
filetype plugin indent on
     filetype    vimFTCmd => Statement       vimCommand => Statement
     plugin      vimFTOption => Type         vimIsCommand
     indent      vimFTOption => Type         vimIsCommand
     on          vimFTOption => Type         vimCommand => Statement

The other ones that I tried were highlighted identically inside 
functions and out of them.

I found this out by means of the following command (which gives four 
replies but 1 and 3 are equal, and so are 2 and 4, AFAICT):

        command -nargs=0 -bar WhatSyntax echomsg 
synIDattr(synID(line("."),col("."),0),"name") 
synIDattr(synIDtrans(synID(line("."),col("."),0)),"name") 
synIDattr(synID(line("."),col("."),1),"name") 
synIDattr(synIDtrans(synID(line("."),col("."),1)),"name")


Notice the many instances of various syntax groups becoming vimIsCommand 
(which has no highlights defined) when inside a function block.

Maybe contains=TOP should be added to the definition of the vimFuncBody 
syntax group? Dr.Chip, what do you think?


Best regards,
Tony.
-- 
I've given up reading books; I find it takes my mind off myself.

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui