135601RE: Syntax Highlighting
- Jan 18, 2013
> Am 17.01.2013 23:31, schrieb Andy Kennedy:Probably did. I guess I need to spend more time with :help syn-define.
> > In the kconfig.vim file, there exists the following:
> > syn keyword kconfigPreProc source
> > \ nextgroup=kconfigPath
> > \ skipwhite
> > Later, there is:
> > syn match kconfigPath '"[^"\\]*\%(\\.[^"\\]*\)*"\|\S\+'
> > \ contained
> > which appears to match something like:
> > source "path/to/myfile"
> > however, it also seems to match
> > source path/to/myfile
> > which has caused me issues in the past. To that end, I want to do
> > something like what lilo.conf has in it where I can set
> > "source path/to/myfile" as Error text so I can clearly see what my
> > problem is.
> > I attempted to do something like:
> > syn match kconfigPreProcError source
> > \ nextgroup=kconfigPathError
> > \ skipwhite
> This should give you
> E402: Garbage after pattern: source nextgroup=kconfigPathError skipwhite
> E475: Invalid argument: kconfigPreProcError source nextgroup=kconfigPathError skipwhite
>Cool! Thanks! I had to make a slight modification to what you put up
> > syn match kconfigPathError '[^"]*.*$'
> > then later
> > hi def link kconfigPreProcError Error
> > But this didn't do what I expected.
> > Please tell me where I've gone wrong.
> > Thanks!
> > Andy
> Try the following:
> syn clear kconfigPreProc
> syn keyword kconfigPreProc source nextgroup=kconfigPath,kconfigPathError skipwhite
> syn match kconfigPathError '[^" \t].*$' contained
> hi def link kconfigPathError Error
syn match kconfigPathError '\s*[^"].*$' contained
Otherwise, the obvious space prior to the path matches and the string is
accepted. I want it to fail for anything not quoted. So, the
modification is to allow any whitespace then look for anything not `"'.
But that really helped. I am super grateful!
> You received this message from the "vim_use" maillist.
> Do not top-post! Type your reply below the text you are replying to.
> For more information, visit http://www.vim.org/maillist.php
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
- << Previous post in topic