Skip to content

Commit 5f45ff9

Browse files
committed
Merge pull request #10 from sleepycat/master
Setting filetype to javascript based on node shebang
2 parents 31f6eff + 405df92 commit 5f45ff9

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

ftdetect/javascript.vim

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
function! s:DetectJS()
2+
if getline(1) =~# '^#!.*/bin/env\s\+node\>'
3+
setfiletype javascript
4+
endif
5+
endfunction
6+
autocmd BufNewFile,BufRead * call s:DetectJS()

syntax/javascript.vim

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ setlocal iskeyword+=$
2828

2929
syntax sync fromstart
3030

31+
"" syntax coloring for Node.js shebang line
32+
syn match shebang "^#!.*/bin/env\s\+node\>"
33+
hi link shebang Comment
34+
3135
"" JavaScript comments"{{{
3236
syn keyword javaScriptCommentTodo TODO FIXME XXX TBD contained
3337
syn match javaScriptLineComment "\/\/.*" contains=@Spell,javaScriptCommentTodo

0 commit comments

Comments
 (0)