Skip to content

Commit bb34fb4

Browse files
committed
improve Coffeescript guard in JS support
1 parent e201767 commit bb34fb4

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

after/syntax/javascript.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
" so until it has specific support there's no point in loading anyway
77
" and for some reason the W3C syntax color keywords break its highlighting
88
" (this refers to the https://github.com/kchmck/vim-coffee-script plugin)
9-
if &filetype == 'coffee' | finish | endif
9+
if -1 < index( split( &filetype, '[.]' ), 'coffee' ) | finish | endif
1010

1111
" javaScriptX = default Vim syntax, jsX = https://github.com/pangloss/vim-javascript
1212
call css_color#init('hex', 'extended'

autoload/css_color.vim

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,14 +255,14 @@ function! css_color#reinit()
255255
endfunction
256256

257257
function! css_color#enable()
258-
exe 'syn cluster colorableGroup add=' . join( b:css_color_grp, ',' )
258+
if len( b:css_color_grp ) | exe 'syn cluster colorableGroup add=' . join( b:css_color_grp, ',' ) | endif
259259
autocmd CSSColor CursorMoved,CursorMovedI <buffer> call s:parse_screen()
260260
let b:css_color_off = 0
261261
call s:parse_screen()
262262
endfunction
263263

264264
function! css_color#disable()
265-
exe 'syn cluster colorableGroup remove=' . join( b:css_color_grp, ',' )
265+
if len( b:css_color_grp ) | exe 'syn cluster colorableGroup remove=' . join( b:css_color_grp, ',' ) | endif
266266
autocmd! CSSColor CursorMoved,CursorMovedI <buffer>
267267
let b:css_color_off = 1
268268
endfunction

0 commit comments

Comments
 (0)