forked from github-mirrors/ale
change ale to use value of g:ale_shell regardless of what it is
This commit is contained in:
parent
8550fa6059
commit
5f613a5fd6
|
@ -12,10 +12,10 @@
|
||||||
let g:ale_command_wrapper = get(g:, 'ale_command_wrapper', '')
|
let g:ale_command_wrapper = get(g:, 'ale_command_wrapper', '')
|
||||||
|
|
||||||
" A setting for the shell used to execute commands
|
" A setting for the shell used to execute commands
|
||||||
let g:ale_shell = get(g:, 'ale_shell', &shell)
|
let g:ale_shell = get(g:, 'ale_shell', v:null)
|
||||||
|
|
||||||
" A setting for the arguments we pass to the shell when executing commands
|
" A setting for the arguments we pass to the shell when executing commands
|
||||||
let g:ale_shell_arguments = get(g:, 'ale_shell_arguments', &shellcmdflag)
|
let g:ale_shell_arguments = get(g:, 'ale_shell_arguments', v:null)
|
||||||
|
|
||||||
if !has_key(s:, 'job_map')
|
if !has_key(s:, 'job_map')
|
||||||
let s:job_map = {}
|
let s:job_map = {}
|
||||||
|
@ -190,15 +190,27 @@ function! ale#job#PrepareCommand(buffer, command) abort
|
||||||
" NeoVim handles this issue automatically if the command is a String,
|
" 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
|
" but we'll do this explicitly, so we use the same exact command for both
|
||||||
" versions.
|
" versions.
|
||||||
if has('win32')
|
if g:ale_shell is v:null
|
||||||
return 'cmd /s/c "' . l:command . '"'
|
if has('win32')
|
||||||
endif
|
return 'cmd /s/c "' . l:command . '"'
|
||||||
|
endif
|
||||||
|
|
||||||
if g:ale_shell =~? 'fish$\|pwsh$'
|
if &shell =~? 'fish$\|pwsh$'
|
||||||
return ['/bin/sh', '-c', l:command]
|
return ['/bin/sh', '-c', l:command]
|
||||||
endif
|
endif
|
||||||
|
|
||||||
return [g:ale_shell] + split(g:ale_shell_arguments) + [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
|
endfunction
|
||||||
|
|
||||||
" Start a job with options which are agnostic to Vim and NeoVim.
|
" Start a job with options which are agnostic to Vim and NeoVim.
|
||||||
|
|
22
doc/ale.txt
22
doc/ale.txt
|
@ -1993,14 +1993,17 @@ g:ale_windows_node_executable_path *g:ale_windows_node_executable_path*
|
||||||
g:ale_shell *g:ale_shell*
|
g:ale_shell *g:ale_shell*
|
||||||
|
|
||||||
Type: |String|
|
Type: |String|
|
||||||
Default: `'&shell'`
|
Default: not set
|
||||||
|
|
||||||
This variable is used to determine which shell ale will use to execute
|
This variable is used to determine which shell ale will use to execute
|
||||||
commands. This variables defaults to the value of the vim option '&shell'
|
commands. By default this variable is undefined, meaning that ALE will use
|
||||||
which corresponds to the $SHELL environment variable. For example
|
it's default behavior. Which is to run shells via the shell determined by
|
||||||
if `$SHELL == '/bin/bash'`, but you want to use zsh, set `g:ale_shell = '/bin/zsh'.`
|
the `&shell` vim variable, with the arguments `&shellcmdflag`. Ale will fall
|
||||||
If this option is set to either `fish` or `pwsh` (either by default or set
|
back to using `/bin/sh`if it detects the underlying `&shell`is either `fish`
|
||||||
with this command), ale will still execute commands with `bin/sh`.
|
or `pwsh`. However, if you set this variable ALE will no longer fall back to
|
||||||
|
other shells, meaning if you wanted to use `fish` you could do so via this
|
||||||
|
option. For example if `$SHELL == '/bin/bash'`, but you want to use zsh,
|
||||||
|
set `g:ale_shell = '/bin/zsh'.
|
||||||
|
|
||||||
Please note - if you are using this option you should consider additionally
|
Please note - if you are using this option you should consider additionally
|
||||||
setting `g:ale``g:ale_shell_arguments` since the default values for that
|
setting `g:ale``g:ale_shell_arguments` since the default values for that
|
||||||
|
@ -2009,12 +2012,11 @@ g:ale_shell *g:ale_shell*
|
||||||
g:ale_shell_arguments *g:ale_shell_arguments*
|
g:ale_shell_arguments *g:ale_shell_arguments*
|
||||||
|
|
||||||
Type: |String|
|
Type: |String|
|
||||||
Default: `'&shellcmdflag'`
|
Default: not set
|
||||||
|
|
||||||
This variable is used to determine what commands vim will pass to the shell
|
This variable is used to determine what commands vim will pass to the shell
|
||||||
to execute it's commands. By default, `&shellcmdflag` would be set to the
|
to execute it's commands. If this command is not set, but g:ale_shell is
|
||||||
value of '`-c'`. Similar to `g:ale_shell`, if the shell is set to either
|
set, ale will use `&shellcmdflag` as command arguments.
|
||||||
`fish` or `pwsh`, `g:ale_shell_arguments` will no be used.
|
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
6.1. Highlights *ale-highlights*
|
6.1. Highlights *ale-highlights*
|
||||||
|
|
|
@ -26,7 +26,7 @@ Before:
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
if !has('win32')
|
if !has('win32')
|
||||||
let g:ale_shell = '/bin/bash'
|
let &shell = '/bin/bash'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
call ale#test#SetDirectory('/testplugin/test')
|
call ale#test#SetDirectory('/testplugin/test')
|
||||||
|
|
|
@ -31,6 +31,6 @@ Execute(Command formatting should be applied correctly for LSP linters):
|
||||||
\ g:args
|
\ g:args
|
||||||
else
|
else
|
||||||
AssertEqual
|
AssertEqual
|
||||||
\ ['true', [g:ale_shell, '-c', '''true'' --foo']],
|
\ ['true', [&shell, '-c', '''true'' --foo']],
|
||||||
\ g:args
|
\ g:args
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -4,7 +4,7 @@ Before:
|
||||||
|
|
||||||
After:
|
After:
|
||||||
Restore
|
Restore
|
||||||
let g:ale_shell = &shell
|
let g:ale_shell = v:null
|
||||||
|
|
||||||
Execute(sh should be used when the shell is fish):
|
Execute(sh should be used when the shell is fish):
|
||||||
if !has('win32')
|
if !has('win32')
|
||||||
|
|
Loading…
Reference in New Issue