mirror of
https://github.com/neovim/neovim.git
synced 2026-06-15 16:23:48 +00:00
fix(option): set 'shell…' options based on detected shell #40031
Problem: * 'shellcmdflag' states that its default value is set according to the value of 'shell', but this behavior is not yet implemented on Windows. The same applies to 'shellpipe', 'shellredir', and 'shellxquote'. * On Windows, Git is often installed in paths containing spaces, and we still do not correctly resolve the sh executable name as described in 'shell'. * On Windows, the default value of 'shellslash' is always `false`, which causes Unix-like shells to interpret `\` in paths returned by some functions as escape charaters. Solution: Use a simple rule table to detect common shells (e.g. `cmd`, `powershell`, shells whose names contain `csh` or `sh`) and apply best-effort defaults, while leaving more complex scenarios to user configuration.
This commit is contained in:
24
runtime/lua/vim/_meta/options.gen.lua
generated
24
runtime/lua/vim/_meta/options.gen.lua
generated
@@ -5914,12 +5914,12 @@ vim.go.shcf = vim.go.shellcmdflag
|
||||
--- For MS-Windows the default is "2>&1| tee". The stdout and stderr are
|
||||
--- saved in a file and echoed to the screen.
|
||||
--- For Unix the default is "| tee". The stdout of the compiler is saved
|
||||
--- in a file and echoed to the screen. If the 'shell' option is "csh" or
|
||||
--- "tcsh" after initializations, the default becomes "|& tee". If the
|
||||
--- 'shell' option is "sh", "ksh", "mksh", "pdksh", "zsh", "zsh-beta",
|
||||
--- "bash", "fish", "ash" or "dash" the default becomes "2>&1| tee". This
|
||||
--- means that stderr is also included. Before using the 'shell' option a
|
||||
--- path is removed, thus "/bin/sh" uses "sh".
|
||||
--- in a file and echoed to the screen. If the 'shell' option contains
|
||||
--- "csh" (e.g. "tcsh") after initializations, the default becomes
|
||||
--- "|& tee". Otherwise, if it contains "sh" (e.g. "bash", "zsh"), the
|
||||
--- default becomes "2>&1| tee". This means that stderr is also included.
|
||||
--- Before using the 'shell' option a path is removed, thus "/bin/sh" uses
|
||||
--- "sh".
|
||||
--- The initialization of this option is done after reading the vimrc
|
||||
--- and the other initializations, so that when the 'shell' option is set
|
||||
--- there, the 'shellpipe' option changes automatically, unless it was
|
||||
@@ -5964,12 +5964,12 @@ vim.go.shq = vim.go.shellquote
|
||||
--- The name of the temporary file can be represented by "%s" if necessary
|
||||
--- (the file name is appended automatically if no %s appears in the value
|
||||
--- of this option).
|
||||
--- The default is ">". For Unix, if the 'shell' option is "csh" or
|
||||
--- "tcsh" during initializations, the default becomes ">&". If the
|
||||
--- 'shell' option is "sh", "ksh", "mksh", "pdksh", "zsh", "zsh-beta",
|
||||
--- "bash" or "fish", the default becomes ">%s 2>&1". This means that
|
||||
--- stderr is also included. For Win32, the Unix checks are done and
|
||||
--- additionally "cmd" is checked for, which makes the default ">%s 2>&1".
|
||||
--- The default is ">". For Unix, if the 'shell' option contains "csh"
|
||||
--- (e.g. "tcsh") during initializations, the default becomes ">&".
|
||||
--- Otherwise, if it contains "sh" (e.g. "bash", "zsh"), the default
|
||||
--- becomes ">%s 2>&1". This means that stderr is also included. For
|
||||
--- Win32, the Unix checks are done and additionally "cmd" is checked
|
||||
--- for, which makes the default ">%s 2>&1".
|
||||
--- Also, the same names with ".exe" appended are checked for.
|
||||
--- The initialization of this option is done after reading the vimrc
|
||||
--- and the other initializations, so that when the 'shell' option is set
|
||||
|
||||
Reference in New Issue
Block a user