Search code examples
vimvim-syntax-highlightingsas-jmp

Vim Syntax file: defining keywords to ignore whitespace


I would like to create a vim syntax file where either:

  1. White space is included in keywords.
  2. White space is ignored in keywords.

Either would work for my purpose, which is to create a JMP scripting language (JSL) syntax file. In JMP, whitespace is ignored in keywords, so New Column("Col1") and NewColumn(Col1`) are identical. The former format, with the space, is the standard.


Solution

  • You can syntax match with a regular expression to include optional whitespace:

    :syntax match GROUPNAME /\<New\s*Column\>/
    

    Note, that this is not quite the same as syntax keyword, because keyword has higher priority. In practice, it rarely matters.