久しぶりにvagrant内にあるvimでhoge.shというファイルを編集しようとしたらエラーが出た。
"path/to/hoge.sh" 0L, 0C Error detected while processing /usr/local/share/vim/vim74/syntax/sh.vim: line 130: W18: Invalid character in group name Press ENTER or type command to continue
syntaxファイルがおかしいらしい。
vimのバージョンはこんな感じ
$vim --version VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Apr 14 2015 02:38:40) Included patches: 1-699 Compiled by vagrant@localhost.localdomain Huge version without GUI. Features included (+) or not (-): +acl +farsi +mouse_netterm +syntax +arabic +file_in_path +mouse_sgr +tag_binary +autocmd +find_in_path -mouse_sysmouse +tag_old_static -balloon_eval +float +mouse_urxvt -tag_any_white -browse +folding +mouse_xterm -tcl ++builtin_terms -footer +multi_byte +terminfo +byte_offset +fork() +multi_lang +termresponse +cindent -gettext -mzscheme +textobjects -clientserver -hangul_input +netbeans_intg +title -clipboard +iconv +path_extra -toolbar +cmdline_compl +insert_expand -perl +user_commands +cmdline_hist +jumplist +persistent_undo +vertsplit +cmdline_info +keymap +postscript +virtualedit +comments +langmap +printer +visual +conceal +libcall +profile +visualextra +cryptv +linebreak -python +viminfo +cscope +lispindent -python3 +vreplace +cursorbind +listcmds +quickfix +wildignore +cursorshape +localmap +reltime +wildmenu +dialog_con +lua +rightleft +windows +diff +menu -ruby +writebackup +digraphs +mksession +scrollbind -X11 -dnd +modify_fname +signs -xfontset -ebcdic +mouse +smartindent -xim +emacs_tags -mouseshape -sniff -xsmp +eval +mouse_dec +startuptime -xterm_clipboard +ex_extra -mouse_gpm +statusline -xterm_save +extra_search -mouse_jsbterm -sun_workshop -xpm system vimrc file: "$VIM/vimrc" user vimrc file: "$HOME/.vimrc" 2nd user vimrc file: "~/.vim/vimrc" user exrc file: "$HOME/.exrc" fall-back for $VIM: "/usr/local/share/vim" Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 Linking: gcc -L/usr/local/lib -Wl,--as-needed -o vim -lm -ltinfo -lnsl -ldl -L/usr/lib -llua
/usr/local/share/vim/vim74/syntax/sh.vim: line 130:
と言われているので、とりあえず見てみることに。
129 syn cluster shIfList>-----------contains=@shLoopList,shDblBrace,shDblParen,shFunctionKey,shFunctionOne,shFunctionT wo 130 syn cluster shLoopList>---------contains=@shCaseLis,t@shErrorList,shCaseEsac,shConditional,shDblBrace,shExpr,shFor ,shForPP,shIf,shOption,shSet,shTest,shTestOpr 131 syn cluster shSubShList>--------contains=@shCommandSubList,shCaseEsac,shColon,shCommandSub,shComment,shDo,shEcho,s hExpr,shFor,shIf,shRedir,shSetList,shSource,shStatement,shVariable,shCtrlSeq,shOperator
うーんなんだろう。
(この時の自分は見る気がなかったのだろう。
invalid character in group name vim shとぐぐると下記ページがヒット。
Yes, there seems to be an extra "t" on that line.
ん・・・?extra "t" ??
おや、 @shCaseLis,t
Lis,t ・・・?タイポ・・・?w
とりあえず、下記のように直しました。
syn cluster shLoopList contains=@shCaseList,shErrorList,shCaseEsac,shConditional,shDblBrace,shExpr,shFor,shForPP,shIf,shOption,shSet,shTest,shTestOpr
動いた。なるほど。