Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add note to compiler script

  • Loading branch information...
commit 089506ed89da1849485fdfcca002a42111759fab 1 parent 30735c9
Mick Koch authored
Showing with 11 additions and 3 deletions.
  1. +11 −3 compiler/coffee.vim
14 compiler/coffee.vim
View
@@ -3,11 +3,20 @@
" URL: http://github.com/kchmck/vim-coffee-script
" License: WTFPL
+" All this is needed to support compiling filenames with spaces, quotes, and
+" such. The filename is escaped and embedded into the `makeprg` setting.
+"
+" Because of this, `makeprg` must be updated on every file rename. And because
+" of that, `CompilerSet` can't be used because it doesn't exist when the
+" rename autocmd is ran. So, we have to do some checks to see whether `compiler`
+" was called locally or globally, and respect that in the rest of the script.
+
if exists('current_compiler')
finish
+else
+ let current_compiler = 'coffee'
endif
-let current_compiler = 'coffee'
" Pattern to check if coffee is the compiler
let s:pat = '^' . current_compiler
@@ -21,8 +30,7 @@ if !exists('coffee_make_options')
let coffee_make_options = ''
endif
-" Get a `makeprg` for the current filename. This is needed to support filenames
-" with spaces and quotes, but also not break generic `make`.
+" Get a `makeprg` for the current filename.
function! s:GetMakePrg()
return g:coffee_compiler . ' -c ' . g:coffee_make_options . ' $* '
\ . fnameescape(expand('%'))
Please sign in to comment.
Something went wrong with that request. Please try again.