1 "============================================================================
3 "Description: Syntax checking plugin for syntastic.vim
4 "Maintainer: Gregor Uhlenheuer <kongo2002 at gmail dot com>
5 "License: This program is free software. It comes without any warranty,
6 " to the extent permitted by applicable law. You can redistribute
7 " it and/or modify it under the terms of the Do What The Fuck You
8 " Want To Public License, Version 2, as published by Sam Hocevar.
9 " See http://sam.zoy.org/wtfpl/COPYING for more details.
11 "============================================================================
12 if exists('loaded_sh_syntax_checker')
15 let loaded_sh_syntax_checker = 1
17 function! s:GetShell()
18 if !exists('b:shell') || b:shell == ""
20 let shebang = getbufline(bufnr('%'), 1)[0]
22 if match(shebang, 'bash') >= 0
24 elseif match(shebang, 'zsh') >= 0
26 elseif match(shebang, 'sh') >= 0
34 function! SyntaxCheckers_sh_GetLocList()
35 if len(s:GetShell()) == 0 || !executable(s:GetShell())
38 let output = split(system(s:GetShell().' -n '.shellescape(expand('%'))), '\n')
41 for err_line in output
42 let line = substitute(err_line, '^[^:]*:\D\{-}\(\d\+\):.*', '\1', '')
43 let msg = substitute(err_line, '^[^:]*:\D\{-}\d\+: \(.*\)', '\1', '')
44 call add(result, {'lnum' : line,