Syntax highlighting and keywords from dictionary

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Syntax highlighting and keywords from dictionary

Alexander Ponomarenko
    Hello all!
    It will be great to have feature to highlight words from dictionary
file. I did not find any way to do it. Instead I must have dictionary
and syntax definitions separately.
    Someone have this task solved? Or maybe ask vim developers to add
'keywordfile' option to syntax:

syn keywordfile cmOptions   ~/.vim/cm-keywords
set dictionary=~/.vim/cm-keywords

Reply | Threaded
Open this post in threaded view
|

Re: Syntax highlighting and keywords from dictionary

Alexander Ponomarenko
    I found some trick to do it. In syntax file I have:

set dictionary=~/.vim/cm-keywords
exec "syn keyword cmOption ".system("xargs -a ~/.vim/cm-keywords")

    It is not very good to use external programs, but this is working.
Last line may be looks like that:

exec "syn keyword cmOption ".system("cat ~/.vim/cm-keywords|xargs")

    because some versions of xargs can't have '-a' option.
    Only last word in list is not highlighted. I don't know why it is.

Alexander Ponomarenko wrote:

>    Hello all!
>    It will be great to have feature to highlight words from dictionary
> file. I did not find any way to do it. Instead I must have dictionary
> and syntax definitions separately.
>    Someone have this task solved? Or maybe ask vim developers to add
> 'keywordfile' option to syntax:
>
> syn keywordfile cmOptions   ~/.vim/cm-keywords
> set dictionary=~/.vim/cm-keywords
>