Friday, January 18, 2013

Re: Syntax Highlighting

Am 17.01.2013 23:31, schrieb Andy Kennedy:
> 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

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

~/.vim/after/syntax/kconfig.vim
#v+

syn clear kconfigPreProc
syn keyword kconfigPreProc source nextgroup=kconfigPath,kconfigPathError skipwhite

syn match kconfigPathError '[^" \t].*$' contained

hi def link kconfigPathError Error

#v-

--
Andy

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

No comments: