Skip to content

Commit 70df206

Browse files
committed
More permissive shebang detection, highlight them
Allows for options on shebangs, like: #!/usr/bin/env scala -unchecked Or -classpath or what have you. Also will match a `scalas` executable, for the SBT script runner [1]. Refs derekwyatt#102, derekwyatt#103 [1]: http://www.scala-sbt.org/0.13/docs/Scripts.html
1 parent bfad7cc commit 70df206

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

ftdetect/scala.vim

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
fun! s:DetectScala()
2-
if getline(1) == '#!/usr/bin/env scala'
2+
if getline(1) =~# '^#!\(/usr\)\?/bin/env\s\+scalas\?'
33
set filetype=scala
44
endif
55
endfun

syntax/scala.vim

+2
Original file line numberDiff line numberDiff line change
@@ -176,13 +176,15 @@ hi link scalaSquareBracketsBrackets Type
176176
hi link scalaTypeOperator Keyword
177177
hi link scalaTypeAnnotationParameter Function
178178

179+
syn match scalaShebang "\%^#!.*" display
179180
syn region scalaMultilineComment start="/\*" end="\*/" contains=scalaMultilineComment,scalaDocLinks,scalaParameterAnnotation,scalaCommentAnnotation,scalaTodo,scalaCommentCodeBlock,@scalaHtml,@Spell keepend
180181
syn match scalaCommentAnnotation "@[_A-Za-z0-9$]\+" contained
181182
syn match scalaParameterAnnotation "@param" nextgroup=scalaParamAnnotationValue skipwhite contained
182183
syn match scalaParamAnnotationValue /[`_A-Za-z0-9$]\+/ contained
183184
syn region scalaDocLinks start="\[\[" end="\]\]" contained
184185
syn region scalaCommentCodeBlock matchgroup=Keyword start="{{{" end="}}}" contained
185186
syn match scalaTodo "\vTODO|FIXME|XXX" contained
187+
hi link scalaShebang Comment
186188
hi link scalaMultilineComment Comment
187189
hi link scalaDocLinks Function
188190
hi link scalaParameterAnnotation Function

0 commit comments

Comments
 (0)