LoginSignup
9
6

More than 5 years have passed since last update.

Vimでejsファイルを開いてもシンタックスハイライトされたい

Posted at

DOCTYPE宣言しているファイルだとちゃんと色がつくのですが、
インクルードファイルだと色がつかないのです :finnadie:

vimrcに以下の設定の記述します。

NeoBundle 'nikvdp/ejs-syntax'

autocmd BufNewFile,BufRead *.ejs set filetype=ejs
autocmd BufNewFile,BufRead *._ejs set filetype=ejs

function! s:DetectEjs()
    if getline(1) =~ '^#!.*\<ejs\>'
        set filetype=ejs
    endif
endfunction

autocmd BufNewFile,BufRead * call s:DetectEjs()

参考URL
http://stackoverflow.com/questions/4597721/syntax-highlight-for-ejs-files-in-vim

9
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
6