vimにTwigのsyntax highlightを適用する
こんにちは。
Twigを使い始めたのですが、vimのデフォルトの設定ではTwigのシンタックスハイライトがないので、いれてみました。
wgetでファイルをダウンロードしてますが、これは「http://www.vim.org/scripts/script.php?script_id=1856」のサイトで適切なものをとってきてください。
$ cd ~/.vim $mkdir syntax $ cd syntax $ wget -O jinja.vim http://www.vim.org/scripts/download_script.php?src_id=8666 $ wget -O htmljinja.vim http://www.vim.org/scripts/download_script.php?src_id=6961
それから、「au BufRead,BufNewFile *.twig set filetype=htmljinja」を追記します。 私の場合は~/.vim/filetype.vimに記述しています。
if exists("did_load_filetypes") finish endif augroup filetypedetect au BufRead,BufNewFile *.py setfiletype python au BufRead,BufNewFile *.php setfiletype php au BufRead,BufNewFile *.twig set filetype=htmljinja augroup END
これで終わりです。
参考記事: http://aaronbonner.io/post/16914552864/enable-syntax-highlighting-for-twig-templates-in-vim