Is there any way to highlight default vim keyword without using match?

razor3x

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?

Ingo Karkat

: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] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

Customizing default tooltip without using any plugin

분류에서Dev

Vim: Using custom highlight groups in statusline

분류에서Dev

Any way to force a form to submit fields differently without using Javascript?

분류에서Dev

Is there any way to kill a zombie process without reboot?

분류에서Dev

Error while passing variables for keyword match using sed

분류에서Dev

Best way to fix using a reserved JQL keyword in a JIRA query?

분류에서Dev

Neo4j index not working without the Using keyword

분류에서Dev

Laravel - Is there any auth package without using database?

분류에서Dev

Most efficient way to grab objects without any duplicates in an array

분류에서Dev

Rails: Is there any way to rename columns without modifying the controllers?

분류에서Dev

Is there any way to copy file's content in clipboard without opening the file?

분류에서Dev

Using Elasticsearch Java API to match any of several words, case insensitive

분류에서Dev

In VIM, replace path with slashes without using escape slashes

분류에서Dev

vim : Highlight tab with one color and spaces with another ?

분류에서Dev

Extend Default Configuration of vim

분류에서Dev

How to match rows with one or more words in query, but without any words not in query?

분류에서Dev

Flutter: Is there any way of using a widget only on ios but not on android?

분류에서Dev

Is there any way to copy a directory to another path using guava library?

분류에서Dev

Is there any way to detect javascript postmessages using chrome extension?

분류에서Dev

append any text to a div using jquery without altering the text

분류에서Dev

how to increase the width of an element without using any loops

분류에서Dev

is there any way to make a rally ruby rest api call for workspaces return all of them instead of just default?

분류에서Dev

Firefox - Get "Highlight all" button to be on by default

분류에서Dev

Using the this keyword with jQuery selectors

분류에서Dev

vim match group of numbers and replace

분류에서Dev

Best way to print graph without using modules Perl

분류에서Dev

Is there a way to position divs on top of each other without using position absolute?

분류에서Dev

ng-Select Option set default value from list if value match using angularJS

분류에서Dev

HTML 내부의 Vim Highlight Perl 코드

Related 관련 기사

  1. 1

    Customizing default tooltip without using any plugin

  2. 2

    Vim: Using custom highlight groups in statusline

  3. 3

    Any way to force a form to submit fields differently without using Javascript?

  4. 4

    Is there any way to kill a zombie process without reboot?

  5. 5

    Error while passing variables for keyword match using sed

  6. 6

    Best way to fix using a reserved JQL keyword in a JIRA query?

  7. 7

    Neo4j index not working without the Using keyword

  8. 8

    Laravel - Is there any auth package without using database?

  9. 9

    Most efficient way to grab objects without any duplicates in an array

  10. 10

    Rails: Is there any way to rename columns without modifying the controllers?

  11. 11

    Is there any way to copy file's content in clipboard without opening the file?

  12. 12

    Using Elasticsearch Java API to match any of several words, case insensitive

  13. 13

    In VIM, replace path with slashes without using escape slashes

  14. 14

    vim : Highlight tab with one color and spaces with another ?

  15. 15

    Extend Default Configuration of vim

  16. 16

    How to match rows with one or more words in query, but without any words not in query?

  17. 17

    Flutter: Is there any way of using a widget only on ios but not on android?

  18. 18

    Is there any way to copy a directory to another path using guava library?

  19. 19

    Is there any way to detect javascript postmessages using chrome extension?

  20. 20

    append any text to a div using jquery without altering the text

  21. 21

    how to increase the width of an element without using any loops

  22. 22

    is there any way to make a rally ruby rest api call for workspaces return all of them instead of just default?

  23. 23

    Firefox - Get "Highlight all" button to be on by default

  24. 24

    Using the this keyword with jQuery selectors

  25. 25

    vim match group of numbers and replace

  26. 26

    Best way to print graph without using modules Perl

  27. 27

    Is there a way to position divs on top of each other without using position absolute?

  28. 28

    ng-Select Option set default value from list if value match using angularJS

  29. 29

    HTML 내부의 Vim Highlight Perl 코드

뜨겁다태그

보관