Patch 8.2.3079
Problem:    Powershell core not supported by default.
Solution:   Set option defaults for "pwsh". (Mike Williams, closes #8481)
Files:      runtime/doc/eval.txt, runtime/doc/options.txt,
            runtime/doc/os_dos.txt, runtime/doc/os_win32.txt, src/fileio.c,
            src/misc2.c, src/option.c, src/os_win32.c,
            src/testdir/test_shell.vim


*** ../vim-8.2.3078/runtime/doc/eval.txt        2021-06-28 20:53:12.386870528 
+0200
--- runtime/doc/eval.txt        2021-06-30 20:48:26.977179376 +0200
***************
*** 9848,9858 ****
  
  shellescape({string} [, {special}])                   *shellescape()*
                Escape {string} for use as a shell command argument.
!               On MS-Windows, when the 'shell' contains powershell then it
!               will enclose {string} in single quotes and will double up all
!               internal single quotes.  With other values for 'shell' when
!               'shellslash' is not set, it will enclose {string} in double
!               quotes and double all double quotes within {string}.
                Otherwise it will enclose {string} in single quotes and
                replace all "'" with "'\''".
  
--- 9888,9900 ----
  
  shellescape({string} [, {special}])                   *shellescape()*
                Escape {string} for use as a shell command argument.
!               When the 'shell' contains powershell (MS-Windows) or pwsh
!               (MS-Windows, Linux, and MacOS) then it will enclose {string}
!               in single quotes and will double up all internal single
!               quotes.
!               On MS-Windows, when 'shellslash' is not set, it will enclose
!               {string} in double quotes and double all double quotes within
!               {string}.
                Otherwise it will enclose {string} in single quotes and
                replace all "'" with "'\''".
  
***************
*** 11012,11019 ****
                        :exe "redir > " . tmpfile
  <             For Unix, the file will be in a private directory |tempfile|.
                For MS-Windows forward slashes are used when the 'shellslash'
!               option is set or when 'shellcmdflag' starts with '-' except
!               when when 'shell' contains powershell.
  
  
  term_ functions are documented here: |terminal-function-details|
--- 11054,11061 ----
                        :exe "redir > " . tmpfile
  <             For Unix, the file will be in a private directory |tempfile|.
                For MS-Windows forward slashes are used when the 'shellslash'
!               option is set, or when 'shellcmdflag' starts with '-' and
!               'shell' does not contain powershell or pwsh.
  
  
  term_ functions are documented here: |terminal-function-details|
***************
*** 11884,11890 ****
  gui_motif             Compiled with Motif GUI.
  gui_photon            Compiled with Photon GUI.
  gui_running           Vim is running in the GUI, or it will start soon.
! gui_win32             Compiled with MS Windows Win32 GUI.
  gui_win32s            idem, and Win32s system being used (Windows 3.1)
  haiku                 Haiku version of Vim.
  hangul_input          Compiled with Hangul input support. |hangul|
--- 11927,11933 ----
  gui_motif             Compiled with Motif GUI.
  gui_photon            Compiled with Photon GUI.
  gui_running           Vim is running in the GUI, or it will start soon.
! gui_win32             Compiled with MS-Windows Win32 GUI.
  gui_win32s            idem, and Win32s system being used (Windows 3.1)
  haiku                 Haiku version of Vim.
  hangul_input          Compiled with Hangul input support. |hangul|
*** ../vim-8.2.3078/runtime/doc/options.txt     2021-06-28 20:53:12.386870528 
+0200
--- runtime/doc/options.txt     2021-06-30 20:48:26.977179376 +0200
***************
*** 6626,6631 ****
--- 6633,6640 ----
        "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".
+       For Unix and MS-Windows, when the 'shell' option is "pwsh" the default
+       becomes ">%s 2>&1" and the output is not echoed to the screen.
        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
***************
*** 6641,6649 ****
        security reasons.
  
                                                *'shellquote'* *'shq'*
! 'shellquote' 'shq'    string  (default: ""; Win32, when 'shell' does not
!                                contain powershell but contains "sh"
!                                somewhere: "\"")
                        global
        Quoting character(s), put around the command passed to the shell, for
        the "!" and ":!" commands.  The redirection is kept outside of the
--- 6650,6656 ----
        security reasons.
  
                                                *'shellquote'* *'shq'*
! 'shellquote' 'shq'    string  (default: "")
                        global
        Quoting character(s), put around the command passed to the shell, for
        the "!" and ":!" commands.  The redirection is kept outside of the
***************
*** 6651,6659 ****
        probably not useful to set both options.
        This is an empty string by default.  Only known to be useful for
        third-party shells on MS-Windows-like systems, such as the MKS Korn
!       Shell or bash, where it should be "\"".  The default is adjusted
!       according the value of 'shell', to reduce the need to set this option
!       by the user.  See |dos-shell|.
        This option cannot be set from a |modeline| or in the |sandbox|, for
        security reasons.
  
--- 6658,6664 ----
        probably not useful to set both options.
        This is an empty string by default.  Only known to be useful for
        third-party shells on MS-Windows-like systems, such as the MKS Korn
!       Shell or bash, where it should be "\"".  See |dos-shell|.
        This option cannot be set from a |modeline| or in the |sandbox|, for
        security reasons.
  
***************
*** 6670,6681 ****
        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",
        and "powershell" is checked for which makes the default
!       "2>&1 | Out-File -Encoding default".  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
        there, the 'shellredir' option changes automatically unless it was
--- 6675,6686 ----
        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", "fish", or "pwsh", 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",
        and "powershell" is checked for which makes the default
!       "2>&1 | Out-File -Encoding default" (see |dos-powershell|).  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
        there, the 'shellredir' option changes automatically unless it was
***************
*** 6690,6696 ****
                        global
                        {only for MS-Windows}
        When set, a forward slash is used when expanding file names.  This is
!       useful when a Unix-like shell is used instead of cmd.exe or
        powershell.exe.  Backward slashes can still be typed, but they are
        changed to forward slashes by Vim.
        Note that setting or resetting this option has no effect for some
--- 6695,6701 ----
                        global
                        {only for MS-Windows}
        When set, a forward slash is used when expanding file names.  This is
!       useful when a Unix-like shell is used instead of cmd.exe, pwsh.exe, or
        powershell.exe.  Backward slashes can still be typed, but they are
        changed to forward slashes by Vim.
        Note that setting or resetting this option has no effect for some
***************
*** 6760,6769 ****
        then ')"' is appended.
        When the value is '(' then also see 'shellxescape'.
        This is an empty string by default on most systems, but is known to be
!       useful for on Win32 version, either for cmd.exe and powershell.exe
!       which automatically strips off the first and last quote on a command,
!       or 3rd-party shells such as the MKS Korn Shell or bash, where it
!       should be "\"".  The default is adjusted according the value of
        'shell', to reduce the need to set this option by the user.  See
        |dos-shell|.
        This option cannot be set from a |modeline| or in the |sandbox|, for
--- 6765,6774 ----
        then ')"' is appended.
        When the value is '(' then also see 'shellxescape'.
        This is an empty string by default on most systems, but is known to be
!       useful for on Win32 version, either for cmd.exe, powershell.exe, or
!       pwsh.exe which automatically strips off the first and last quote on a
!       command, or 3rd-party shells such as the MKS Korn Shell or bash, where
!       it should be "\"".  The default is adjusted according the value of
        'shell', to reduce the need to set this option by the user.  See
        |dos-shell|.
        This option cannot be set from a |modeline| or in the |sandbox|, for
*** ../vim-8.2.3078/runtime/doc/os_dos.txt      2021-06-28 20:53:12.386870528 
+0200
--- runtime/doc/os_dos.txt      2021-06-30 20:48:26.977179376 +0200
***************
*** 304,343 ****
  set as described above.
  
  ==============================================================================
! 10. PowerShell                                                *dos-powershell*
  
! Vim also supports Windows PowerShell.  If 'shell' has been set to
! "powershell.exe" at startup then VIM sets 'shellcmdflag', 'shellxquote',
! 'shellpipe', and 'shellredir' options to the following values:
  
  'shellcmdflag'        -Command
  'shellxquote' "
  'shellpipe'   2>&1 | Out-File -Encoding default
  'shellredir'  2>&1 | Out-File -Encoding default
  
  If you find that PowerShell commands are taking a long time to run then try
! setting 'shellcmdflag' to "-NoProfile -Command".  Note this will prevent any
! PowerShell environment setup by the profile from taking place.
  
  If you have problems running PowerShell scripts through the 'shell' then try
! setting 'shellcmdflag' to "-ExecutionPolicy RemoteSigned -Command".  See
! online Windows documentation for more information on PowerShell Execution
! Policy settings.
  
  The 'shellpipe' and 'shellredir' option values re-encode the UTF-16le output
! from Windows PowerShell to your currently configured console codepage.  The
  output can be forced into a different encoding by changing "default" to one of
  the following:
  
        unicode          - UTF-16le (default output from PowerShell 5.1)
        bigendianunicode - UTF-16
        utf8             - UTF-8
!       utf7             - UTF-7 (no-BOM)
        utf32            - UTF-32
        ascii            - 7-bit ASCII character set
        default          - System's active code page (typically ANSI)
        oem              - System's current OEM code page
  
! Note Multi-byte Unicode encodings include a leading BOM.
  
   vim:tw=78:ts=8:noet:ft=help:norl:
--- 304,383 ----
  set as described above.
  
  ==============================================================================
! 10. PowerShell                                        *dos-powershell* 
*dos-pwsh*
  
! Vim supports PowerShell Desktop and PowerShell Core.  PowerShell Desktop is
! the version of PowerShell that is installed with Windows, while PowerShell
! Core is a separate downloadable version that works cross-platform.  To see
! which version you are using then enter the following in a PowerShell prompt -
! $PSVersionTable.PSEdition
! 
! If 'shell' includes "powershell" in the filename at startup then VIM sets
! 'shellcmdflag', 'shellxquote', 'shellpipe', and 'shellredir' options to the
! following values:
  
  'shellcmdflag'        -Command
  'shellxquote' "
  'shellpipe'   2>&1 | Out-File -Encoding default
  'shellredir'  2>&1 | Out-File -Encoding default
  
+ If 'shell' includes "pwsh" in the filename at startup then VIM sets
+ 'shellcmdflag', 'shellxquote', 'shellpipe', and 'shellredir' options to the
+ following values:
+ 
+ 'shellcmdflag'        -c
+ 'shellxquote' "
+ 'shellpipe'   >%s 2>&1
+ 'shellredir'  >%s 2>&1
+ 
  If you find that PowerShell commands are taking a long time to run then try
! with "-NoProfile" at the beginning of the 'shellcmdflag'.  Note this will
! prevent any PowerShell environment setup by the profile from taking place.
  
  If you have problems running PowerShell scripts through the 'shell' then try
! with "-ExecutionPolicy RemoteSigned -Command" at the beginning of
! 'shellcmdflag'.  See online Windows documentation for more information on
! PowerShell Execution Policy settings.
! 
! See |option-backslash| about including spaces in 'shellcmdflag' when using
! multiple flags.
  
  The 'shellpipe' and 'shellredir' option values re-encode the UTF-16le output
! from PowerShell Desktop to your currently configured console codepage.  The
  output can be forced into a different encoding by changing "default" to one of
  the following:
  
        unicode          - UTF-16le (default output from PowerShell 5.1)
        bigendianunicode - UTF-16
        utf8             - UTF-8
!       utf7             - UTF-7 (no BOM)
        utf32            - UTF-32
        ascii            - 7-bit ASCII character set
        default          - System's active code page (typically ANSI)
        oem              - System's current OEM code page
  
! Note The abovce multi-byte Unicode encodings include a leading BOM unless
! otherwise indicated.
! 
! By default PowerShell Core's output is UTF-8 encoded without a BOM.  If you
! want to force the output of PowerShell Core into a different encoding then set
! 'shellredir' and 'shellpipe' to "2>&1 | Out-File -Encoding encoding" where
! encoding is one of the following:
! 
!       ascii            - 7-bit ASCII character set
!       bigendianunicode - UTF-16be
!       bigendianutf32   - UTF-32be
!       oem              - System's current OEM code page
!       unicode          - UTF-16le
!       utf7             - UTF-7
!       utf8             - UTF-8
!       utf8BOM          - UTF-8, with BOM
!       utf8NoBOM        - UTF-8, no BOM (default output from PowerShell Core)
!       utf32            - UTF-32
! 
! Since PowerShell Core 6.2, the Encoding parameter also supports specifying a
! numeric ID of a registered code page (-Encoding 1251) or string names of
! registered code pages (-Encoding "windows-1251").  The .NET documentation for
! Encoding.CodePage has more information
  
   vim:tw=78:ts=8:noet:ft=help:norl:
*** ../vim-8.2.3078/runtime/doc/os_win32.txt    2021-01-31 17:02:06.258490157 
+0100
--- runtime/doc/os_win32.txt    2021-06-30 20:48:26.977179376 +0200
***************
*** 30,35 ****
--- 30,36 ----
  Interrupting                  |dos-CTRL-Break|
  Temp files                    |dos-temp-files|
  Shell option default          |dos-shell|
+ PowerShell defaults           |dos-powershell|
  
  Win32 GUI                     |gui-w32|
  
***************
*** 83,89 ****
  
  Command line arguments                                        *win32-cmdargs*
  
! Analysis of a command line into parameters is not standardised in MS Windows.
  Vim and gvim used to use different logic to parse it (before 7.4.432), and the
  logic was also depended on what it was compiled with.  Now Vim and gvim both
  use the CommandLineToArgvW() Win32 API, so they behave in the same way.
--- 84,90 ----
  
  Command line arguments                                        *win32-cmdargs*
  
! Analysis of a command line into parameters is not standardised in MS-Windows.
  Vim and gvim used to use different logic to parse it (before 7.4.432), and the
  logic was also depended on what it was compiled with.  Now Vim and gvim both
  use the CommandLineToArgvW() Win32 API, so they behave in the same way.
*** ../vim-8.2.3078/src/fileio.c        2021-06-28 20:53:12.390870518 +0200
--- src/fileio.c        2021-06-30 20:48:26.981179369 +0200
***************
*** 5222,5227 ****
--- 5222,5228 ----
      WCHAR     *chartab = L"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
      char_u    *retval;
      char_u    *p;
+     char_u    *shname;
      long      i;
  
      wcscpy(itmp, L"");
***************
*** 5247,5254 ****
      // "sh".  NOTE: This also checks 'shellcmdflag' to help those people who
      // didn't set 'shellslash' but only if not using PowerShell.
      retval = utf16_to_enc(itmp, NULL);
!     if ((strstr((char *)gettail(p_sh), "powershell") == NULL
!                                               && *p_shcf == '-') || p_ssl)
        for (p = retval; *p; ++p)
            if (*p == '\\')
                *p = '/';
--- 5248,5257 ----
      // "sh".  NOTE: This also checks 'shellcmdflag' to help those people who
      // didn't set 'shellslash' but only if not using PowerShell.
      retval = utf16_to_enc(itmp, NULL);
!     shname = gettail(p_sh);
!     if ((*p_shcf == '-' && !(strstr((char *)shname, "powershell") != NULL
!                            || strstr((char *)shname, "pwsh") != NULL ))
!                                                                   || p_ssl)
        for (p = retval; *p; ++p)
            if (*p == '\\')
                *p = '/';
*** ../vim-8.2.3078/src/misc2.c 2021-06-28 20:53:12.390870518 +0200
--- src/misc2.c 2021-06-30 20:48:26.981179369 +0200
***************
*** 1414,1421 ****
      char_u    *escaped_string;
      int               l;
      int               csh_like;
! # ifdef MSWIN
      int               powershell;
      int               double_quotes;
  # endif
  
--- 1414,1422 ----
      char_u    *escaped_string;
      int               l;
      int               csh_like;
!     char_u    *shname;
      int               powershell;
+ # ifdef MSWIN
      int               double_quotes;
  # endif
  
***************
*** 1425,1433 ****
      // Csh also needs to have "\n" escaped twice when do_special is set.
      csh_like = csh_like_shell();
  
  # ifdef MSWIN
!     // PowerShell only accepts single quotes so override p_ssl.
!     powershell = strstr((char *)gettail(p_sh), "powershell") != NULL;
      double_quotes = !powershell && !p_ssl;
  # endif
  
--- 1426,1437 ----
      // Csh also needs to have "\n" escaped twice when do_special is set.
      csh_like = csh_like_shell();
  
+     // PowerShell uses it's own version for quoting single quotes
+     shname = gettail(p_sh);
+     powershell = strstr((char *)shname, "pwsh") != NULL;
  # ifdef MSWIN
!     powershell = powershell || strstr((char *)shname, "powershell") != NULL;
!     // PowerShell only accepts single quotes so override shellslash.
      double_quotes = !powershell && !p_ssl;
  # endif
  
***************
*** 1445,1455 ****
  # endif
        if (*p == '\'')
        {
- # ifdef MSWIN
            if (powershell)
                length +=2;             // ' => ''
            else
- # endif
                length += 3;            // ' => '\''
        }
        if ((*p == '\n' && (csh_like || do_newline))
--- 1449,1457 ----
***************
*** 1497,1510 ****
  # endif
            if (*p == '\'')
            {
- # ifdef MSWIN
                if (powershell)
                {
                    *d++ = '\'';
                    *d++ = '\'';
                }
                else
- # endif
                {
                    *d++ = '\'';
                    *d++ = '\\';
--- 1499,1510 ----
*** ../vim-8.2.3078/src/option.c        2021-06-28 20:53:12.390870518 +0200
--- src/option.c        2021-06-30 20:48:26.981179369 +0200
***************
*** 933,940 ****
            }
        }
  # ifdef MSWIN
!       // PowerShell 5.1/.NET outputs UTF-16 with BOM so re-encode to the
!       // current codepage
        else if (   fnamecmp(p, "powershell") == 0
                    || fnamecmp(p, "powershell.exe") == 0
                )
--- 933,940 ----
            }
        }
  # ifdef MSWIN
!       // Windows PowerShell output is UTF-16 with BOM so re-encode to the
!       // current codepage.
        else if (   fnamecmp(p, "powershell") == 0
                    || fnamecmp(p, "powershell.exe") == 0
                )
***************
*** 965,970 ****
--- 965,971 ----
                    || fnamecmp(p, "fish") == 0
                    || fnamecmp(p, "ash") == 0
                    || fnamecmp(p, "dash") == 0
+                   || fnamecmp(p, "pwsh") == 0
  # ifdef MSWIN
                    || fnamecmp(p, "cmd") == 0
                    || fnamecmp(p, "sh.exe") == 0
***************
*** 976,981 ****
--- 977,983 ----
                    || fnamecmp(p, "bash.exe") == 0
                    || fnamecmp(p, "cmd.exe") == 0
                    || fnamecmp(p, "dash.exe") == 0
+                   || fnamecmp(p, "pwsh.exe") == 0
  # endif
                    )
            {
***************
*** 985,991 ****
  #  ifdef MSWIN
                    p_sp = (char_u *)">%s 2>&1";
  #  else
!                   p_sp = (char_u *)"2>&1| tee";
  #  endif
                    options[idx_sp].def_val[VI_DEFAULT] = p_sp;
                }
--- 987,996 ----
  #  ifdef MSWIN
                    p_sp = (char_u *)">%s 2>&1";
  #  else
!                   if (fnamecmp(p, "pwsh") == 0)
!                       p_sp = (char_u *)">%s 2>&1";
!                   else
!                       p_sp = (char_u *)"2>&1| tee";
  #  endif
                    options[idx_sp].def_val[VI_DEFAULT] = p_sp;
                }
***************
*** 1011,1016 ****
--- 1016,1022 ----
       *                            p_shcf      p_sxq
       * cmd.exe          -   "/c"      "("
       * powershell.exe   -   "-Command"        "\""
+      * pwsh.exe               -   "-c"        "\""
       * "sh" like shells -   "-c"      "\""
       *
       * For Win32 p_sxq is set instead of p_shq to include shell redirection.
*** ../vim-8.2.3078/src/os_win32.c      2021-06-28 20:53:12.390870518 +0200
--- src/os_win32.c      2021-06-30 20:48:26.981179369 +0200
***************
*** 2135,2140 ****
--- 2135,2141 ----
      char_u    *pathbuf = NULL;
      char_u    *pathext = NULL;
      char_u    *pathextbuf = NULL;
+     char_u    *shname = NULL;
      int               noext = FALSE;
      int               retval = FALSE;
  
***************
*** 2142,2149 ****
        return FALSE;
  
      // Using the name directly when a Unix-shell like 'shell'.
!     if (strstr((char *)gettail(p_sh), "powershell") == NULL
!                               && strstr((char *)gettail(p_sh), "sh") != NULL)
        noext = TRUE;
  
      if (use_pathext)
--- 2143,2152 ----
        return FALSE;
  
      // Using the name directly when a Unix-shell like 'shell'.
!     shname = gettail(p_sh);
!     if (strstr((char *)shname, "sh") != NULL &&
!       !(strstr((char *)shname, "powershell") != NULL
!                                   || strstr((char *)shname, "pwsh") != NULL))
        noext = TRUE;
  
      if (use_pathext)
*** ../vim-8.2.3078/src/testdir/test_shell.vim  2021-06-28 20:53:12.390870518 
+0200
--- src/testdir/test_shell.vim  2021-06-30 20:48:26.981179369 +0200
***************
*** 19,25 ****
            \ ['ash', '-c', '2>&1| tee', '', '>%s 2>&1', '', ''],
            \ ['dash', '-c', '2>&1| tee', '', '>%s 2>&1', '', ''],
            \ ['csh', '-c', '|& tee', '', '>&', '', ''],
!           \ ['tcsh', '-c', '|& tee', '', '>&', '', '']]
    endif
    if has('win32')
      let shells += [['cmd', '/c', '>%s 2>&1', '', '>%s 2>&1', '"&|<>()@^', ''],
--- 19,26 ----
            \ ['ash', '-c', '2>&1| tee', '', '>%s 2>&1', '', ''],
            \ ['dash', '-c', '2>&1| tee', '', '>%s 2>&1', '', ''],
            \ ['csh', '-c', '|& tee', '', '>&', '', ''],
!           \ ['tcsh', '-c', '|& tee', '', '>&', '', ''],
!           \ ['pwsh', '-c', '>%s 2>&1', '', '>%s 2>&1', '', '']]
    endif
    if has('win32')
      let shells += [['cmd', '/c', '>%s 2>&1', '', '>%s 2>&1', '"&|<>()@^', ''],
***************
*** 28,33 ****
--- 29,36 ----
            \           '', '2>&1 | Out-File -Encoding default', '"&|<>()@^', 
'"'],
            \ ['powershell', '-Command', '2>&1 | Out-File -Encoding default', 
'',
            \               '2>&1 | Out-File -Encoding default', '"&|<>()@^', 
'"'],
+           \ ['pwsh.exe', '-c', '>%s 2>&1', '', '>%s 2>&1', '"&|<>()@^', '"'],
+           \ ['pwsh', '-c', '>%s 2>&1', '', '>%s 2>&1', '"&|<>()@^', '"'],
            \ ['sh.exe', '-c', '>%s 2>&1', '', '>%s 2>&1', '"&|<>()@^', '"'],
            \ ['ksh.exe', '-c', '>%s 2>&1', '', '>%s 2>&1', '"&|<>()@^', '"'],
            \ ['mksh.exe', '-c', '>%s 2>&1', '', '>%s 2>&1', '"&|<>()@^', '"'],
***************
*** 61,66 ****
--- 64,70 ----
        let str1 = "'cmd \"arg1\" '\\''arg2'\\'' \\!%#'"
        let str2 = "'cmd \"arg1\" '\\''arg2'\\'' \\\\!\\%\\#'"
      elseif e[0] =~# '.*powershell$' || e[0] =~# '.*powershell.exe$'
+           \ || e[0] =~# '.*pwsh$' || e[0] =~# '.*pwsh.exe$'
        let str1 = "'cmd \"arg1\" ''arg2'' !%#'"
        let str2 = "'cmd \"arg1\" ''arg2'' \\!\\%\\#'"
      else
***************
*** 76,84 ****
        let [&shellcmdflag, &shellpipe, &shellquote, &shellredir,
              \ &shellxescape, &shellxquote] = e[1:6]
        new
!       r !echo hello
!       call assert_equal('hello', substitute(getline(2), '\W', '', 'g'), e[0])
!       bwipe!
      endif
    endfor
    set shell& shellcmdflag& shellpipe& shellquote&
--- 80,93 ----
        let [&shellcmdflag, &shellpipe, &shellquote, &shellredir,
              \ &shellxescape, &shellxquote] = e[1:6]
        new
!       try
!         r !echo hello
!         call assert_equal('hello', substitute(getline(2), '\W', '', 'g'), 
e[0])
!       catch
!         call assert_report('Failed to run shell command, shell: ' .. e[0])
!       finally
!         bwipe!
!       endtry
      endif
    endfor
    set shell& shellcmdflag& shellpipe& shellquote&
***************
*** 149,154 ****
--- 158,165 ----
    " ".*\\\\[^\\\\]*$"
    let shells = [['cmd', '/c', '\\', '/'],
          \ ['powershell', '-Command', '\\', '/'],
+         \ ['pwsh', '-Command', '\\', '/'],
+         \ ['pwsh', '-c', '\\', '/'],
          \ ['sh', '-c', '/', '/']]
    for e in shells
      exe 'set shell=' .. e[0] .. ' | set shellcmdflag=' .. e[1]
*** ../vim-8.2.3078/src/version.c       2021-06-30 20:39:11.366130953 +0200
--- src/version.c       2021-06-30 20:50:37.804952234 +0200
***************
*** 757,758 ****
--- 757,760 ----
  {   /* Add new patch number below this line */
+ /**/
+     3079,
  /**/

-- 
Creating the world with Emacs:   M-x let-there-be-light
Creating the world with Vim:     :make world

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202106301856.15UIuSf61527038%40masaka.moolenaar.net.

Raspunde prin e-mail lui