aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/os/shell.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2022-08-20 06:47:28 +0800
committerzeertzjq <zeertzjq@outlook.com>2022-08-20 07:25:22 +0800
commit6d6e9c5d5140ab591ea07e653d4e055606e157c4 (patch)
tree5f05f65cc27c41cd5b3b1354db212780ed49d2fd /src/nvim/os/shell.c
parentf342194396df126093f4575cea3a8546a6ba30a5 (diff)
downloadrneovim-6d6e9c5d5140ab591ea07e653d4e055606e157c4.tar.gz
rneovim-6d6e9c5d5140ab591ea07e653d4e055606e157c4.tar.bz2
rneovim-6d6e9c5d5140ab591ea07e653d4e055606e157c4.zip
vim-patch:8.2.3623: "$*" is expanded to "nonomatch"
Problem: "$*" is expanded to "nonomatch". Solution: Only add "set nonomatch" when using a csh-like shell. (Christian Brabandt, closes vim/vim#9159, closes vim/vim#9153) https://github.com/vim/vim/commit/8b8d829faf04fe3706c04f7f7000054acd3254e7 Cherry-pick a line from patch 8.2.0522.
Diffstat (limited to 'src/nvim/os/shell.c')
-rw-r--r--src/nvim/os/shell.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/nvim/os/shell.c b/src/nvim/os/shell.c
index dd44cb1ce7..b793b8f9c6 100644
--- a/src/nvim/os/shell.c
+++ b/src/nvim/os/shell.c
@@ -249,10 +249,16 @@ int os_expand_wildcards(int num_pat, char **pat, int *num_file, char ***file, in
}
STRCAT(command, ">");
} else {
- if (flags & EW_NOTFOUND) {
- STRCPY(command, "set nonomatch; ");
- } else {
- STRCPY(command, "unset nonomatch; ");
+ STRCPY(command, "");
+ if (shell_style == STYLE_GLOB) {
+ // Assume the nonomatch option is valid only for csh like shells,
+ // otherwise, this may set the positional parameters for the shell,
+ // e.g. "$*".
+ if (flags & EW_NOTFOUND) {
+ STRCAT(command, "set nonomatch; ");
+ } else {
+ STRCAT(command, "unset nonomatch; ");
+ }
}
if (shell_style == STYLE_GLOB) {
STRCAT(command, "glob >");