mirror of
https://github.com/amix/vimrc
synced 2025-06-24 07:44:59 +08:00
Updated plugins
This commit is contained in:
@ -18,41 +18,6 @@ let g:loaded_syntastic_sh_sh_checker = 1
|
||||
let s:save_cpo = &cpo
|
||||
set cpo&vim
|
||||
|
||||
function! s:GetShell()
|
||||
if !exists('b:shell') || b:shell == ''
|
||||
let b:shell = ''
|
||||
let shebang = getbufline(bufnr('%'), 1)[0]
|
||||
if shebang != ''
|
||||
if stridx(shebang, 'bash') >= 0
|
||||
let b:shell = 'bash'
|
||||
elseif stridx(shebang, 'zsh') >= 0
|
||||
let b:shell = 'zsh'
|
||||
elseif stridx(shebang, 'sh') >= 0
|
||||
let b:shell = 'sh'
|
||||
endif
|
||||
endif
|
||||
" try to use env variable in case no shebang could be found
|
||||
if b:shell == ''
|
||||
let b:shell = fnamemodify(expand('$SHELL'), ':t')
|
||||
endif
|
||||
endif
|
||||
return b:shell
|
||||
endfunction
|
||||
|
||||
function! s:ForwardToZshChecker()
|
||||
let registry = g:SyntasticRegistry.Instance()
|
||||
if registry.isCheckable('zsh')
|
||||
return registry.getCheckers('zsh', ['zsh'])[0].getLocListRaw()
|
||||
else
|
||||
return []
|
||||
endif
|
||||
endfunction
|
||||
|
||||
function! s:IsShellValid()
|
||||
return len(s:GetShell()) > 0 && executable(s:GetShell())
|
||||
endfunction
|
||||
|
||||
|
||||
function! SyntaxCheckers_sh_sh_IsAvailable() dict
|
||||
return s:IsShellValid()
|
||||
endfunction
|
||||
@ -77,6 +42,42 @@ function! SyntaxCheckers_sh_sh_GetLocList() dict
|
||||
\ 'errorformat': errorformat })
|
||||
endfunction
|
||||
|
||||
function! s:GetShell()
|
||||
if !exists('b:shell') || b:shell == ''
|
||||
let b:shell = ''
|
||||
let shebang = syntastic#util#parseShebang()['exe']
|
||||
if shebang != ''
|
||||
if shebang[-strlen('bash'):-1] ==# 'bash'
|
||||
let b:shell = 'bash'
|
||||
elseif shebang[-strlen('zsh'):-1] ==# 'zsh'
|
||||
let b:shell = 'zsh'
|
||||
elseif shebang[-strlen('sh'):-1] ==# 'sh'
|
||||
let b:shell = 'sh'
|
||||
endif
|
||||
endif
|
||||
" try to use env variable in case no shebang could be found
|
||||
if b:shell == ''
|
||||
let b:shell = fnamemodify(expand('$SHELL'), ':t')
|
||||
endif
|
||||
endif
|
||||
return b:shell
|
||||
endfunction
|
||||
|
||||
function! s:IsShellValid()
|
||||
let shell = s:GetShell()
|
||||
return shell != '' && executable(shell)
|
||||
endfunction
|
||||
|
||||
function! s:ForwardToZshChecker()
|
||||
let registry = g:SyntasticRegistry.Instance()
|
||||
let zsh_checkers = registry.getCheckersAvailable('zsh', ['zsh'])
|
||||
if !empty(zsh_checkers)
|
||||
return zsh_checkers[0].getLocListRaw()
|
||||
else
|
||||
return []
|
||||
endif
|
||||
endfunction
|
||||
|
||||
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
||||
\ 'filetype': 'sh',
|
||||
\ 'name': 'sh' })
|
||||
|
Reference in New Issue
Block a user