Skip to content

Commit

Permalink
patch 8.2.3623: "$*" is expanded to "nonomatch"
Browse files Browse the repository at this point in the history
Problem:    "$*" is expanded to "nonomatch".
Solution:   Only add "set nonomatch" when using a csh-like shell. (Christian
            Brabandt, closes #9159, closes #9153)
  • Loading branch information
chrisbra authored and brammool committed Nov 19, 2021
1 parent 64be6aa commit 8b8d829
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
3 changes: 0 additions & 3 deletions runtime/doc/map.txt
Expand Up @@ -1009,9 +1009,6 @@ or `unnamedplus`.
The `mode()` function will return the state as it will be after applying the
operator.

The `mode()` function will return the state as it will be after applying the
operator.

Here is an example for using a lambda function to create a normal-mode
operator to add quotes around text in the current line: >
Expand Down
15 changes: 11 additions & 4 deletions src/os_unix.c
Expand Up @@ -6691,10 +6691,17 @@ mch_expand_wildcards(
}
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 >");
else if (shell_style == STYLE_PRINT)
Expand Down
6 changes: 6 additions & 0 deletions src/testdir/test_expand.vim
@@ -1,6 +1,7 @@
" Test for expanding file names

source shared.vim
source check.vim

func Test_with_directories()
call mkdir('Xdir1')
Expand Down Expand Up @@ -135,4 +136,9 @@ func Test_expand_filename_multicmd()
%bwipe!
endfunc

func Test_expandcmd_shell_nonomatch()
CheckNotMSWindows
call assert_equal('$*', expandcmd('$*'))
endfunc

" vim: shiftwidth=2 sts=2 expandtab
2 changes: 2 additions & 0 deletions src/version.c
Expand Up @@ -757,6 +757,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
3623,
/**/
3622,
/**/
Expand Down

0 comments on commit 8b8d829

Please sign in to comment.