diff options
author | Bartek thindil Jasicki <thindil@laeran.pl> | 2020-11-06 13:31:59 +0100 |
---|---|---|
committer | Bartek thindil Jasicki <thindil@laeran.pl> | 2020-11-06 13:31:59 +0100 |
commit | 01b661ea25c1abb4f2e6808661d52c7ebdfac85c (patch) | |
tree | 0bdfa9beadab6b86f8807fda311ae359c3cf8f90 | |
parent | b84d41f9ea354111073679c3c9576a6baa69eb96 (diff) | |
parent | 1ec573bf0df6cbc5eef8b593f93081e4c1837c1b (diff) | |
download | ale-01b661ea25c1abb4f2e6808661d52c7ebdfac85c.zip |
Merge remote-tracking branch 'upstream/master'
-rw-r--r-- | autoload/ale/handlers/sh.vim | 22 | ||||
-rw-r--r-- | autoload/ale/handlers/shellcheck.vim | 9 |
2 files changed, 16 insertions, 15 deletions
diff --git a/autoload/ale/handlers/sh.vim b/autoload/ale/handlers/sh.vim index 1e50cb89..6ed9fea3 100644 --- a/autoload/ale/handlers/sh.vim +++ b/autoload/ale/handlers/sh.vim @@ -1,18 +1,28 @@ " Author: w0rp <devw0rp@gmail.com> -" Get the shell type for a buffer, based on the hashbang line. function! ale#handlers#sh#GetShellType(buffer) abort - let l:bang_line = get(getbufline(a:buffer, 1), 0, '') + let l:shebang = get(getbufline(a:buffer, 1), 0, '') let l:command = '' - " Take the shell executable from the hashbang, if we can. - if l:bang_line[:1] is# '#!' + " Take the shell executable from the shebang, if we can. + if l:shebang[:1] is# '#!' " Remove options like -e, etc. - let l:command = substitute(l:bang_line, ' --\?[a-zA-Z0-9]\+', '', 'g') + let l:command = substitute(l:shebang, ' --\?[a-zA-Z0-9]\+', '', 'g') endif - " If we couldn't find a hashbang, try the filetype + " With no shebang line, attempt to use Vim's buffer-local variables. + if l:command is# '' + if getbufvar(a:buffer, 'is_bash', 0) + let l:command = 'bash' + elseif getbufvar(a:buffer, 'is_sh', 0) + let l:command = 'sh' + elseif getbufvar(a:buffer, 'is_kornshell', 0) + let l:command = 'ksh' + endif + endif + + " If we couldn't find a shebang, try the filetype if l:command is# '' let l:command = &filetype endif diff --git a/autoload/ale/handlers/shellcheck.vim b/autoload/ale/handlers/shellcheck.vim index b16280f0..351d6d3f 100644 --- a/autoload/ale/handlers/shellcheck.vim +++ b/autoload/ale/handlers/shellcheck.vim @@ -13,15 +13,6 @@ function! ale#handlers#shellcheck#GetDialectArgument(buffer) abort return l:shell_type endif - " If there's no hashbang, try using Vim's buffer variables. - if getbufvar(a:buffer, 'is_bash', 0) - return 'bash' - elseif getbufvar(a:buffer, 'is_sh', 0) - return 'sh' - elseif getbufvar(a:buffer, 'is_kornshell', 0) - return 'ksh' - endif - return '' endfunction |