mirror of
https://github.com/jelera/vim-javascript-syntax.git
synced 2025-12-11 23:22:02 +08:00
Merge pull request #10 from sleepycat/master
Setting filetype to javascript based on node shebang
This commit is contained in:
6
ftdetect/javascript.vim
Normal file
6
ftdetect/javascript.vim
Normal 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()
|
||||
@@ -28,6 +28,10 @@ setlocal iskeyword+=$
|
||||
|
||||
syntax sync fromstart
|
||||
|
||||
"" syntax coloring for Node.js shebang line
|
||||
syn match shebang "^#!.*/bin/env\s\+node\>"
|
||||
hi link shebang Comment
|
||||
|
||||
"" JavaScript comments"{{{
|
||||
syn keyword javaScriptCommentTodo TODO FIXME XXX TBD contained
|
||||
syn match javaScriptLineComment "\/\/.*" contains=@Spell,javaScriptCommentTodo
|
||||
|
||||
Reference in New Issue
Block a user