diff options
author | w0rp <w0rp@users.noreply.github.com> | 2019-01-03 21:01:13 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-03 21:01:13 +0000 |
commit | 7919db0db56c8eae4701d3b71a64bc0089478a0d (patch) | |
tree | 69f6e480e695b433e6316c355776da7baa99ae09 /autoload | |
parent | 1b264b86621430fd190ba6b2d464ed0b34de59f9 (diff) | |
parent | 5f613a5fd69f4135d892a71b1f825f062ff45758 (diff) | |
download | ale-7919db0db56c8eae4701d3b71a64bc0089478a0d.zip |
Merge pull request #2167 from stegmanh/master
Add support for ale option to override default shell used by ale
Diffstat (limited to 'autoload')
-rw-r--r-- | autoload/ale/job.vim | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/autoload/ale/job.vim b/autoload/ale/job.vim index 0117c7dd..1af95049 100644 --- a/autoload/ale/job.vim +++ b/autoload/ale/job.vim @@ -11,6 +11,12 @@ " A setting for wrapping commands. let g:ale_command_wrapper = get(g:, 'ale_command_wrapper', '') +" A setting for the shell used to execute commands +let g:ale_shell = get(g:, 'ale_shell', v:null) + +" A setting for the arguments we pass to the shell when executing commands +let g:ale_shell_arguments = get(g:, 'ale_shell_arguments', v:null) + if !has_key(s:, 'job_map') let s:job_map = {} endif @@ -184,15 +190,27 @@ function! ale#job#PrepareCommand(buffer, command) abort " NeoVim handles this issue automatically if the command is a String, " but we'll do this explicitly, so we use the same exact command for both " versions. - if has('win32') - return 'cmd /s/c "' . l:command . '"' - endif + if g:ale_shell is v:null + if has('win32') + return 'cmd /s/c "' . l:command . '"' + endif - if &shell =~? 'fish$\|pwsh$' - return ['/bin/sh', '-c', l:command] - endif + if &shell =~? 'fish$\|pwsh$' + return ['/bin/sh', '-c', l:command] + endif - return split(&shell) + split(&shellcmdflag) + [l:command] + return split(&shell) + split(&shellcmdflag) + [l:command] + else + if has('win32') + return g:ale_shell . l:command . '"' + endif + + let l:shell_arguments = g:ale_shell_arguments is v:null + \ ? &shellcmdflag + \ : g:ale_shell_arguments + + return split(g:ale_shell) + split(l:shell_arguments) + [l:command] + endif endfunction " Start a job with options which are agnostic to Vim and NeoVim. |