vimの構文を強調

vimの構文を強調

したがって、*.scこのタイプのテキストファイルで特定のキーワードの構文を強調するために~/.vim/syntax/sc.cim。以下はファイルの内容です。

user $ cd ~/.vim/syntax/
user $ cat sc.vim 
" Syntax highlightor file for files ending in *.sc
syn keyword basicLanguageKeywords interface channel behavior
user $

また、次の行を追加しました。~/.vimrc

au BufRead,BufNewFile *.sc set filetype=sc

:set syntax=scこれでvimでこれを行うと、構文の強調がファイルで機能する*.scことを願っています。しかし、うまくいきません。

ここで何の問題がありますか?

ベストアンサー1

たとえば、一意の構文グループ名を生成する場合は、そのbasicLanguageKeywords強調設定を生成する必要があります。構文設定がほとんどのカラースキームで機能するように、一般的な名前に固執します。確認する:h group-name:

To be able to allow each user to pick his favorite set of colors, there must
be preferred names for highlight groups that are common for many languages.
These are the suggested group names (if syntax highlighting works properly
you can see the actual color, except for "Ignore"):
    *Comment        any comment

    *Constant       any constant
     String         a string constant: "this is a string"
     Character      a character constant: 'c', '\n'
     Number         a number constant: 234, 0xff
     Boolean        a boolean constant: TRUE, false
     Float          a floating point constant: 2.3e10

    *Identifier     any variable name
     Function       function name (also: methods for classes)

    *Statement      any statement
     Conditional    if, then, else, endif, switch, etc.
     Repeat         for, do, while, etc.
     Label          case, default, etc.
     Operator       "sizeof", "+", "*", etc.
     Keyword        any other keyword
     Exception      try, catch, throw

この場合はKeyword

おすすめ記事