mirror of
https://github.com/amix/vimrc
synced 2025-07-07 00:15:00 +08:00
Adding submodules and stuff.
This commit is contained in:
52
sources_non_forked/syntastic/syntax_checkers/ruby/jruby.vim
Normal file
52
sources_non_forked/syntastic/syntax_checkers/ruby/jruby.vim
Normal file
@ -0,0 +1,52 @@
|
||||
"============================================================================
|
||||
"File: jruby.vim
|
||||
"Description: Syntax checking plugin for syntastic.vim
|
||||
"Maintainer: Leonid Shevtsov <leonid at shevtsov dot me>
|
||||
"License: This program is free software. It comes without any warranty,
|
||||
" to the extent permitted by applicable law. You can redistribute
|
||||
" it and/or modify it under the terms of the Do What The Fuck You
|
||||
" Want To Public License, Version 2, as published by Sam Hocevar.
|
||||
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
"
|
||||
"============================================================================
|
||||
if exists("g:loaded_syntastic_ruby_jruby_checker")
|
||||
finish
|
||||
endif
|
||||
let g:loaded_syntastic_ruby_jruby_checker=1
|
||||
|
||||
function! SyntaxCheckers_ruby_jruby_IsAvailable()
|
||||
return executable('jruby')
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_ruby_jruby_GetLocList()
|
||||
let makeprg = syntastic#makeprg#build({
|
||||
\ 'exe': s:exe(),
|
||||
\ 'args': s:args(),
|
||||
\ 'filetype': 'ruby',
|
||||
\ 'subchecker': 'jruby' })
|
||||
|
||||
let errorformat =
|
||||
\ '%-GSyntax OK for %f,'.
|
||||
\ '%ESyntaxError in %f:%l: syntax error\, %m,'.
|
||||
\ '%Z%p^,'.
|
||||
\ '%W%f:%l: warning: %m,'.
|
||||
\ '%Z%p^,'.
|
||||
\ '%W%f:%l: %m,'.
|
||||
\ '%-C%.%#'
|
||||
|
||||
return SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat })
|
||||
endfunction
|
||||
|
||||
function s:args()
|
||||
return has('win32') ? '-W1 -T1 -c' : '-W1 -c'
|
||||
endfunction
|
||||
|
||||
function s:exe()
|
||||
return has('win32') ? 'jruby' : 'RUBYOPT= jruby'
|
||||
endfunction
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
\ 'filetype': 'ruby',
|
||||
\ 'name': 'jruby'})
|
@ -0,0 +1,43 @@
|
||||
"============================================================================
|
||||
"File: macruby.vim
|
||||
"Description: Syntax checking plugin for syntastic.vim
|
||||
"License: This program is free software. It comes without any warranty,
|
||||
" to the extent permitted by applicable law. You can redistribute
|
||||
" it and/or modify it under the terms of the Do What The Fuck You
|
||||
" Want To Public License, Version 2, as published by Sam Hocevar.
|
||||
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
"
|
||||
"============================================================================
|
||||
if exists("g:loaded_syntastic_ruby_macruby_checker")
|
||||
finish
|
||||
endif
|
||||
let g:loaded_syntastic_ruby_macruby_checker=1
|
||||
|
||||
function! SyntaxCheckers_ruby_macruby_IsAvailable()
|
||||
return executable('macruby')
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_ruby_macruby_GetLocList()
|
||||
let makeprg = syntastic#makeprg#build({
|
||||
\ 'exe': 'RUBYOPT= macruby',
|
||||
\ 'args': '-W1 -c',
|
||||
\ 'filetype': 'ruby',
|
||||
\ 'subchecker': 'macruby' })
|
||||
|
||||
let errorformat =
|
||||
\ '%-GSyntax OK,'.
|
||||
\ '%E%f:%l: syntax error\, %m,'.
|
||||
\ '%Z%p^,'.
|
||||
\ '%W%f:%l: warning: %m,'.
|
||||
\ '%Z%p^,'.
|
||||
\ '%W%f:%l: %m,'.
|
||||
\ '%-C%.%#'
|
||||
|
||||
return SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat })
|
||||
endfunction
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
\ 'filetype': 'ruby',
|
||||
\ 'name': 'macruby'})
|
77
sources_non_forked/syntastic/syntax_checkers/ruby/mri.vim
Normal file
77
sources_non_forked/syntastic/syntax_checkers/ruby/mri.vim
Normal file
@ -0,0 +1,77 @@
|
||||
"============================================================================
|
||||
"File: mri.vim
|
||||
"Description: Syntax checking plugin for syntastic.vim
|
||||
"Maintainer: Martin Grenfell <martin.grenfell at gmail dot com>
|
||||
"License: This program is free software. It comes without any warranty,
|
||||
" to the extent permitted by applicable law. You can redistribute
|
||||
" it and/or modify it under the terms of the Do What The Fuck You
|
||||
" Want To Public License, Version 2, as published by Sam Hocevar.
|
||||
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
"
|
||||
"============================================================================
|
||||
|
||||
if exists("g:loaded_syntastic_ruby_mri_checker")
|
||||
finish
|
||||
endif
|
||||
let g:loaded_syntastic_ruby_mri_checker=1
|
||||
|
||||
if !exists("g:syntastic_ruby_exec")
|
||||
let g:syntastic_ruby_exec = "ruby"
|
||||
endif
|
||||
|
||||
function! SyntaxCheckers_ruby_mri_IsAvailable()
|
||||
return executable(expand(g:syntastic_ruby_exec))
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_ruby_mri_GetHighlightRegex(i)
|
||||
if match(a:i['text'], 'assigned but unused variable') > -1
|
||||
let term = split(a:i['text'], ' - ')[1]
|
||||
return '\V\<'.term.'\>'
|
||||
endif
|
||||
|
||||
return ''
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_ruby_mri_GetLocList()
|
||||
let exe = expand(g:syntastic_ruby_exec)
|
||||
if !has('win32')
|
||||
let exe = 'RUBYOPT= ' . exe
|
||||
endif
|
||||
|
||||
let makeprg = syntastic#makeprg#build({
|
||||
\ 'exe': exe,
|
||||
\ 'args': '-w -T1 -c',
|
||||
\ 'filetype': 'ruby',
|
||||
\ 'subchecker': 'mri' })
|
||||
|
||||
"this is a hack to filter out a repeated useless warning in rspec files
|
||||
"containing lines like
|
||||
"
|
||||
" foo.should == 'bar'
|
||||
"
|
||||
"Which always generate the warning below. Note that ruby >= 1.9.3 includes
|
||||
"the word "possibly" in the warning
|
||||
let errorformat = '%-G%.%#warning: %\(possibly %\)%\?useless use of == in void context,'
|
||||
|
||||
" filter out lines starting with ...
|
||||
" long lines are truncated and wrapped in ... %p then returns the wrong
|
||||
" column offset
|
||||
let errorformat .= '%-G%\%.%\%.%\%.%.%#,'
|
||||
|
||||
let errorformat .=
|
||||
\ '%-GSyntax OK,'.
|
||||
\ '%E%f:%l: syntax error\, %m,'.
|
||||
\ '%Z%p^,'.
|
||||
\ '%W%f:%l: warning: %m,'.
|
||||
\ '%Z%p^,'.
|
||||
\ '%W%f:%l: %m,'.
|
||||
\ '%-C%.%#'
|
||||
|
||||
return SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat })
|
||||
endfunction
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
\ 'filetype': 'ruby',
|
||||
\ 'name': 'mri'})
|
@ -0,0 +1,55 @@
|
||||
"============================================================================
|
||||
"File: rubocop.vim
|
||||
"Description: Syntax checking plugin for syntastic.vim
|
||||
"Maintainer: Recai Oktaş <roktas@bil.omu.edu.tr>
|
||||
"License: This program is free software. It comes without any warranty,
|
||||
" to the extent permitted by applicable law. You can redistribute
|
||||
" it and/or modify it under the terms of the Do What The Fuck You
|
||||
" Want To Public License, Version 2, as published by Sam Hocevar.
|
||||
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
||||
"
|
||||
"============================================================================
|
||||
"
|
||||
" In order to use rubocop with the default ruby checker (mri):
|
||||
" let g:syntastic_ruby_checkers = ['mri', 'rubocop']
|
||||
|
||||
if exists("g:loaded_syntastic_ruby_rubocop_checker")
|
||||
finish
|
||||
endif
|
||||
let g:loaded_syntastic_ruby_rubocop_checker=1
|
||||
|
||||
function! SyntaxCheckers_ruby_rubocop_IsAvailable()
|
||||
return
|
||||
\ executable('rubocop') &&
|
||||
\ syntastic#util#versionIsAtLeast(syntastic#util#parseVersion('rubocop --version'), [0,9,0])
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_ruby_rubocop_GetLocList()
|
||||
let makeprg = syntastic#makeprg#build({
|
||||
\ 'exe': 'rubocop',
|
||||
\ 'args': '--format emacs --silent',
|
||||
\ 'filetype': 'ruby',
|
||||
\ 'subchecker': 'rubocop' })
|
||||
|
||||
let errorformat = '%f:%l:%c: %t: %m'
|
||||
|
||||
let loclist = SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'subtype': 'Style'})
|
||||
|
||||
" convert rubocop severities to error types recognized by syntastic
|
||||
for n in range(len(loclist))
|
||||
if loclist[n]['type'] == 'F'
|
||||
let loclist[n]['type'] = 'E'
|
||||
elseif loclist[n]['type'] != 'W' && loclist[n]['type'] != 'E'
|
||||
let loclist[n]['type'] = 'W'
|
||||
endif
|
||||
endfor
|
||||
|
||||
return loclist
|
||||
endfunction
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
\ 'filetype': 'ruby',
|
||||
\ 'name': 'rubocop'})
|
Reference in New Issue
Block a user