summaryrefslogtreecommitdiff
path: root/ale_linters/sh
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2016-10-09 19:32:01 +0100
committerw0rp <devw0rp@gmail.com>2016-10-09 19:32:01 +0100
commit9d52d968db9b6cfdc493e1418348a3ff26177230 (patch)
tree5d78e2fd6eb42fc08d832aab5963c554b1d47873 /ale_linters/sh
parent34241edcdbc562f074988ba54b970a6ecf8dd4d9 (diff)
downloadale-9d52d968db9b6cfdc493e1418348a3ff26177230.zip
#69 Improve shell detection
Diffstat (limited to 'ale_linters/sh')
-rw-r--r--ale_linters/sh/shell.vim16
1 files changed, 7 insertions, 9 deletions
diff --git a/ale_linters/sh/shell.vim b/ale_linters/sh/shell.vim
index f5987c03..ce8aa6c8 100644
--- a/ale_linters/sh/shell.vim
+++ b/ale_linters/sh/shell.vim
@@ -14,20 +14,18 @@ if !exists('g:ale_linters_sh_shell_default_shell')
endif
function! ale_linters#sh#shell#GetExecutable(buffer)
- let shell = g:ale_linters_sh_shell_default_shell
-
let banglines = getbufline(a:buffer, 1)
" Take the shell executable from the hashbang, if we can.
- if len(banglines) == 1
- let bangmatch = matchlist(banglines[0], '^#!\([^ ]\+\)')
-
- if len(bangmatch) > 0
- let shell = bangmatch[1]
- endif
+ if len(banglines) == 1 && banglines[0] =~# '^#!'
+ for possible_shell in ['bash', 'tcsh', 'csh', 'zsh', 'sh']
+ if banglines[0] =~# possible_shell . '\s*$'
+ return possible_shell
+ endif
+ endfor
endif
- return shell
+ return g:ale_linters_sh_shell_default_shell
endfunction
function! ale_linters#sh#shell#GetCommand(buffer)