I'm making custom .vim syntax highlighting, and there is one problem with syntax file. Here's the code:
syn keyword vimKeyword contains contained
When i'm trying to open .vim files it gives an error, because contains
is an actual keyword:
Error detected while processing .vim/syntax/vim.vim
E395: contains argument not accepted here
Is it possible to highlight default vim keywords without using syn match
?
:help E789
mentions this:
Note that when you have a keyword that is the same as an option (even one that isn't allowed here), you can not use it. Use a match instead.
That said, what seems to work for me is defining just a single keyword contains
:
syn keyword vimKeyword contains
Additional keywords can be defined via separate :syn keyword vimKeyword
commands, as they are cummulative.
Another trick is defining the keyword with an optional tail, but keeping it empty:
syn keyword vimKeyword contains[] contained
But as both of these are (mis-)using implementation specifics of the Vimscript parser, I would not rely on them, and instead use :syntax match
, as documented.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다