diff options
| author | Adam Stankiewicz <sheerun@sher.pl> | 2013-09-12 16:17:03 +0200 | 
|---|---|---|
| committer | Adam Stankiewicz <sheerun@sher.pl> | 2013-09-12 16:17:03 +0200 | 
| commit | 01fe1500df97577452f755b526c09d8ed0c802ea (patch) | |
| tree | 9e2e038630cc9e82abcd17da6dd3407a9b3bc62a /compiler | |
| parent | dce12af91b404835938e95de9e6d839d52487ed5 (diff) | |
| download | vim-polyglot-01fe1500df97577452f755b526c09d8ed0c802ea.tar.gz vim-polyglot-01fe1500df97577452f755b526c09d8ed0c802ea.zip | |
Add support for basic languages
coffee, cucumbeer, eruby, haml, haskell, javascript,
json, less, nginx, ocaml, ruby, sass, scss, slim,
stylus, textile, tmux
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/bundler.vim | 26 | ||||
| -rw-r--r-- | compiler/cake.vim | 15 | ||||
| -rw-r--r-- | compiler/coffee.vim | 82 | ||||
| -rw-r--r-- | compiler/cucumber.vim | 29 | ||||
| -rw-r--r-- | compiler/eruby.vim | 39 | ||||
| -rw-r--r-- | compiler/haml.vim | 28 | ||||
| -rw-r--r-- | compiler/rake.vim | 35 | ||||
| -rw-r--r-- | compiler/rspec.vim | 33 | ||||
| -rw-r--r-- | compiler/ruby.vim | 45 | ||||
| -rw-r--r-- | compiler/rubyunit.vim | 33 | ||||
| -rw-r--r-- | compiler/sass.vim | 30 | 
11 files changed, 395 insertions, 0 deletions
| diff --git a/compiler/bundler.vim b/compiler/bundler.vim new file mode 100644 index 00000000..b129793a --- /dev/null +++ b/compiler/bundler.vim @@ -0,0 +1,26 @@ +" Vim compiler file + +if exists("current_compiler") +  finish +endif +let current_compiler = "bundler" + +let s:cpo_save = &cpo +set cpo-=C + +CompilerSet makeprg=bundle + +CompilerSet errorformat= +      \%+E%f:%l:\ parse\ error, +      \%W%f:%l:\ warning:\ %m, +      \%E%f:%l:in\ %*[^:]:\ %m, +      \%E%f:%l:\ %m, +      \%-C%\tfrom\ %f:%l:in\ %.%#, +      \%-Z%\tfrom\ %f:%l, +      \%-Z%p^, +      \%-G%.%# + +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim: sw=2: diff --git a/compiler/cake.vim b/compiler/cake.vim new file mode 100644 index 00000000..0a3c7037 --- /dev/null +++ b/compiler/cake.vim @@ -0,0 +1,15 @@ +" Language:    CoffeeScript +" Maintainer:  Mick Koch <kchmck@gmail.com> +" URL:         http://github.com/kchmck/vim-coffee-script +" License:     WTFPL + +if exists('current_compiler') +  finish +endif + +let current_compiler = 'cake' +call coffee#CoffeeSetUpVariables() + +exec 'CompilerSet makeprg=' . escape(g:coffee_cake . ' ' . +\                                    g:coffee_cake_options . ' $*', ' ') +call coffee#CoffeeSetUpErrorFormat() diff --git a/compiler/coffee.vim b/compiler/coffee.vim new file mode 100644 index 00000000..f521ca9e --- /dev/null +++ b/compiler/coffee.vim @@ -0,0 +1,82 @@ +" Language:    CoffeeScript +" Maintainer:  Mick Koch <kchmck@gmail.com> +" 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 +endif + +let current_compiler = 'coffee' +call coffee#CoffeeSetUpVariables() + +" Pattern to check if coffee is the compiler +let s:pat = '^' . current_compiler + +" Get a `makeprg` for the current filename. +function! s:GetMakePrg() +  return g:coffee_compiler . +  \      ' -c' . +  \      ' ' . b:coffee_litcoffee . +  \      ' ' . g:coffee_make_options . +  \      ' ' . fnameescape(expand('%')) . +  \      ' $*' +endfunction + +" Set `makeprg` and return 1 if coffee is still the compiler, else return 0. +function! s:SetMakePrg() +  if &l:makeprg =~ s:pat +    let &l:makeprg = s:GetMakePrg() +  elseif &g:makeprg =~ s:pat +    let &g:makeprg = s:GetMakePrg() +  else +    return 0 +  endif + +  return 1 +endfunction + +" Set a dummy compiler so we can check whether to set locally or globally. +exec 'CompilerSet makeprg=' . current_compiler +" Then actually set the compiler. +call s:SetMakePrg() +call coffee#CoffeeSetUpErrorFormat() + +function! s:CoffeeMakeDeprecated(bang, args) +  echoerr 'CoffeeMake is deprecated! Please use :make instead, its behavior ' . +  \       'is identical.' +  sleep 5 +  exec 'make' . a:bang a:args +endfunction + +" Compile the current file. +command! -bang -bar -nargs=* CoffeeMake +\        call s:CoffeeMakeDeprecated(<q-bang>, <q-args>) + +" Set `makeprg` on rename since we embed the filename in the setting. +augroup CoffeeUpdateMakePrg +  autocmd! + +  " Update `makeprg` if coffee is still the compiler, else stop running this +  " function. +  function! s:UpdateMakePrg() +    if !s:SetMakePrg() +      autocmd! CoffeeUpdateMakePrg +    endif +  endfunction + +  " Set autocmd locally if compiler was set locally. +  if &l:makeprg =~ s:pat +    autocmd BufFilePost,BufWritePost <buffer> call s:UpdateMakePrg() +  else +    autocmd BufFilePost,BufWritePost          call s:UpdateMakePrg() +  endif +augroup END diff --git a/compiler/cucumber.vim b/compiler/cucumber.vim new file mode 100644 index 00000000..c020be6e --- /dev/null +++ b/compiler/cucumber.vim @@ -0,0 +1,29 @@ +" Vim compiler file +" Compiler:	Cucumber +" Maintainer:	Tim Pope <vimNOSPAM@tpope.org> +" Last Change:	2010 Aug 09 + +if exists("current_compiler") +  finish +endif +let current_compiler = "cucumber" + +if exists(":CompilerSet") != 2		" older Vim always used :setlocal +  command -nargs=* CompilerSet setlocal <args> +endif + +let s:cpo_save = &cpo +set cpo-=C + +CompilerSet makeprg=cucumber + +CompilerSet errorformat= +      \%W%m\ (Cucumber::Undefined), +      \%E%m\ (%.%#), +      \%Z%f:%l, +      \%Z%f:%l:%.%# + +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim:set sw=2 sts=2: diff --git a/compiler/eruby.vim b/compiler/eruby.vim new file mode 100644 index 00000000..45ad5eea --- /dev/null +++ b/compiler/eruby.vim @@ -0,0 +1,39 @@ +" Vim compiler file +" Language:		eRuby +" Maintainer:		Doug Kearns <dougkearns@gmail.com> +" URL:			https://github.com/vim-ruby/vim-ruby +" Release Coordinator:	Doug Kearns <dougkearns@gmail.com> + +if exists("current_compiler") +  finish +endif +let current_compiler = "eruby" + +if exists(":CompilerSet") != 2		" older Vim always used :setlocal +  command -nargs=* CompilerSet setlocal <args> +endif + +let s:cpo_save = &cpo +set cpo-=C + +if exists("eruby_compiler") && eruby_compiler == "eruby" +  CompilerSet makeprg=eruby +else +  CompilerSet makeprg=erb +endif + +CompilerSet errorformat= +    \eruby:\ %f:%l:%m, +    \%+E%f:%l:\ parse\ error, +    \%W%f:%l:\ warning:\ %m, +    \%E%f:%l:in\ %*[^:]:\ %m, +    \%E%f:%l:\ %m, +    \%-C%\tfrom\ %f:%l:in\ %.%#, +    \%-Z%\tfrom\ %f:%l, +    \%-Z%p^, +    \%-G%.%# + +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim: nowrap sw=2 sts=2 ts=8: diff --git a/compiler/haml.vim b/compiler/haml.vim new file mode 100644 index 00000000..b06a672d --- /dev/null +++ b/compiler/haml.vim @@ -0,0 +1,28 @@ +" Vim compiler file +" Compiler:	Haml +" Maintainer:	Tim Pope <vimNOSPAM@tpope.org> +" Last Change:	2013 May 30 + +if exists("current_compiler") +  finish +endif +let current_compiler = "haml" + +if exists(":CompilerSet") != 2		" older Vim always used :setlocal +  command -nargs=* CompilerSet setlocal <args> +endif + +let s:cpo_save = &cpo +set cpo-=C + +CompilerSet makeprg=haml\ -c + +CompilerSet errorformat= +      \Haml\ %trror\ on\ line\ %l:\ %m, +      \Syntax\ %trror\ on\ line\ %l:\ %m, +      \%-G%.%# + +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim:set sw=2 sts=2: diff --git a/compiler/rake.vim b/compiler/rake.vim new file mode 100644 index 00000000..3bd9da0d --- /dev/null +++ b/compiler/rake.vim @@ -0,0 +1,35 @@ +" Vim compiler file +" Language:		Rake +" Maintainer:		Tim Pope <vimNOSPAM@tpope.org> +" URL:			https://github.com/vim-ruby/vim-ruby +" Release Coordinator:	Doug Kearns <dougkearns@gmail.com> + +if exists("current_compiler") +  finish +endif +let current_compiler = "rake" + +if exists(":CompilerSet") != 2		" older Vim always used :setlocal +  command -nargs=* CompilerSet setlocal <args> +endif + +let s:cpo_save = &cpo +set cpo-=C + +CompilerSet makeprg=rake + +CompilerSet errorformat= +      \%D(in\ %f), +      \%\\s%#from\ %f:%l:%m, +      \%\\s%#from\ %f:%l:, +      \%\\s%##\ %f:%l:%m, +      \%\\s%##\ %f:%l, +      \%\\s%#[%f:%l:\ %#%m, +      \%\\s%#%f:%l:\ %#%m, +      \%\\s%#%f:%l:, +      \%m\ [%f:%l]: + +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim: nowrap sw=2 sts=2 ts=8: diff --git a/compiler/rspec.vim b/compiler/rspec.vim new file mode 100644 index 00000000..7c340bab --- /dev/null +++ b/compiler/rspec.vim @@ -0,0 +1,33 @@ +" Vim compiler file +" Language:		RSpec +" Maintainer:		Tim Pope <vimNOSPAM@tpope.org> +" URL:			https://github.com/vim-ruby/vim-ruby +" Release Coordinator:	Doug Kearns <dougkearns@gmail.com> + +if exists("current_compiler") +  finish +endif +let current_compiler = "rspec" + +if exists(":CompilerSet") != 2		" older Vim always used :setlocal +  command -nargs=* CompilerSet setlocal <args> +endif + +let s:cpo_save = &cpo +set cpo-=C + +CompilerSet makeprg=rspec + +CompilerSet errorformat= +    \%f:%l:\ %tarning:\ %m, +    \%E%.%#:in\ `load':\ %f:%l:%m, +    \%E%f:%l:in\ `%*[^']':\ %m, +    \%-Z\ \ \ \ \ \#\ %f:%l:%.%#, +    \%E\ \ %\\d%\\+)%.%#, +    \%C\ \ \ \ \ %m, +    \%-G%.%# + +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim: nowrap sw=2 sts=2 ts=8: diff --git a/compiler/ruby.vim b/compiler/ruby.vim new file mode 100644 index 00000000..dcf7a401 --- /dev/null +++ b/compiler/ruby.vim @@ -0,0 +1,45 @@ +" Vim compiler file +" Language:		Ruby +" Function:		Syntax check and/or error reporting +" Maintainer:		Tim Pope <vimNOSPAM@tpope.org> +" URL:			https://github.com/vim-ruby/vim-ruby +" Release Coordinator:	Doug Kearns <dougkearns@gmail.com> +" ---------------------------------------------------------------------------- + +if exists("current_compiler") +  finish +endif +let current_compiler = "ruby" + +if exists(":CompilerSet") != 2		" older Vim always used :setlocal +  command -nargs=* CompilerSet setlocal <args> +endif + +let s:cpo_save = &cpo +set cpo-=C + +" default settings runs script normally +" add '-c' switch to run syntax check only: +" +"   CompilerSet makeprg=ruby\ -wc\ $* +" +" or add '-c' at :make command line: +" +"   :make -c %<CR> +" +CompilerSet makeprg=ruby\ -w\ $* + +CompilerSet errorformat= +    \%+E%f:%l:\ parse\ error, +    \%W%f:%l:\ warning:\ %m, +    \%E%f:%l:in\ %*[^:]:\ %m, +    \%E%f:%l:\ %m, +    \%-C%\tfrom\ %f:%l:in\ %.%#, +    \%-Z%\tfrom\ %f:%l, +    \%-Z%p^, +    \%-G%.%# + +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim: nowrap sw=2 sts=2 ts=8: diff --git a/compiler/rubyunit.vim b/compiler/rubyunit.vim new file mode 100644 index 00000000..93a0c8e6 --- /dev/null +++ b/compiler/rubyunit.vim @@ -0,0 +1,33 @@ +" Vim compiler file +" Language:		Test::Unit - Ruby Unit Testing Framework +" Maintainer:		Doug Kearns <dougkearns@gmail.com> +" URL:			https://github.com/vim-ruby/vim-ruby +" Release Coordinator:	Doug Kearns <dougkearns@gmail.com> + +if exists("current_compiler") +  finish +endif +let current_compiler = "rubyunit" + +if exists(":CompilerSet") != 2		" older Vim always used :setlocal +  command -nargs=* CompilerSet setlocal <args> +endif + +let s:cpo_save = &cpo +set cpo-=C + +CompilerSet makeprg=testrb + +CompilerSet errorformat=\%W\ %\\+%\\d%\\+)\ Failure:, +			\%C%m\ [%f:%l]:, +			\%E\ %\\+%\\d%\\+)\ Error:, +			\%C%m:, +			\%C\ \ \ \ %f:%l:%.%#, +			\%C%m, +			\%Z\ %#, +			\%-G%.%# + +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim: nowrap sw=2 sts=2 ts=8: diff --git a/compiler/sass.vim b/compiler/sass.vim new file mode 100644 index 00000000..376a52b3 --- /dev/null +++ b/compiler/sass.vim @@ -0,0 +1,30 @@ +" Vim compiler file +" Compiler:	Sass +" Maintainer:	Tim Pope <vimNOSPAM@tpope.org> +" Last Change:	2013 May 30 + +if exists("current_compiler") +  finish +endif +let current_compiler = "sass" + +if exists(":CompilerSet") != 2		" older Vim always used :setlocal +  command -nargs=* CompilerSet setlocal <args> +endif + +let s:cpo_save = &cpo +set cpo-=C + +CompilerSet makeprg=sass\ -c + +CompilerSet errorformat= +      \%f:%l:%m\ (Sass::Syntax%trror), +      \%ESyntax\ %trror:%m, +      \%C%\\s%\\+on\ line\ %l\ of\ %f, +      \%Z%.%#, +      \%-G%.%# + +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim:set sw=2 sts=2: | 
