Set filetype based on node shebang

Recognizes the node shebang line and sets the filetype to javascript.
Syntax highlights the shebang as well.
This commit is contained in:
Mike Williamson
2012-05-24 20:35:40 -04:00
parent 2648939cbf
commit 405df92c21
2 changed files with 10 additions and 0 deletions

6
ftdetect/javascript.vim Normal file
View File

@@ -0,0 +1,6 @@
function! s:DetectJS()
if getline(1) =~# '^#!.*/bin/env\s\+node\>'
setfiletype javascript
endif
endfunction
autocmd BufNewFile,BufRead * call s:DetectJS()