summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authorMike Williams <mikew@globalgraphics.com>2021-06-30 20:56:00 +0200
committerBram Moolenaar <Bram@vim.org>2021-06-30 20:56:00 +0200
commita3d1b29bd36487167c98b3cefa30f06c529e412d (patch)
treec2f313a89feb1b97cdd945ce904d258b518e9cae /runtime
parent834193afd7195bc96026d2aed696d64f8075cd35 (diff)
patch 8.2.3079: Powershell core not supported by defaultv8.2.3079
Problem: Powershell core not supported by default. Solution: Set option defaults for "pwsh". (Mike Williams, closes #8481)
Diffstat (limited to 'runtime')
-rw-r--r--runtime/doc/eval.txt16
-rw-r--r--runtime/doc/options.txt28
-rw-r--r--runtime/doc/os_dos.txt64
-rw-r--r--runtime/doc/os_win32.txt1
4 files changed, 75 insertions, 34 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 7fb2534538..2eceece64b 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -9878,11 +9878,13 @@ sha256({string}) *sha256()*
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}.
+ 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 "'\''".
@@ -11042,8 +11044,8 @@ tempname() *tempname()* *temp-file-name*
: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.
+ option is set, or when 'shellcmdflag' starts with '-' and
+ 'shell' does not contain powershell or pwsh.
term_ functions are documented here: |terminal-function-details|
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index b958cf63ed..af2e23eca7 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -6633,6 +6633,8 @@ A jump table for the options with a short description can be found at |Q_op|.
"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
@@ -6648,9 +6650,7 @@ A jump table for the options with a short description can be found at |Q_op|.
security reasons.
*'shellquote'* *'shq'*
-'shellquote' 'shq' string (default: ""; Win32, when 'shell' does not
- contain powershell but contains "sh"
- somewhere: "\"")
+'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
@@ -6658,9 +6658,7 @@ A jump table for the options with a short description can be found at |Q_op|.
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|.
+ 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.
@@ -6677,12 +6675,12 @@ A jump table for the options with a short description can be found at |Q_op|.
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
+ "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". Also, the same names with ".exe"
- appended are checked for.
+ "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
@@ -6697,7 +6695,7 @@ A jump table for the options with a short description can be found at |Q_op|.
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
+ 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
@@ -6767,10 +6765,10 @@ A jump table for the options with a short description can be found at |Q_op|.
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
+ 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
diff --git a/runtime/doc/os_dos.txt b/runtime/doc/os_dos.txt
index b45cb088cb..b473134ce1 100644
--- a/runtime/doc/os_dos.txt
+++ b/runtime/doc/os_dos.txt
@@ -304,40 +304,80 @@ Vim sets the 'shellcmdflag' and 'shellquote' or 'shellxquote' options will be
set as described above.
==============================================================================
-10. PowerShell *dos-powershell*
+10. PowerShell *dos-powershell* *dos-pwsh*
-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:
+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
-setting 'shellcmdflag' to "-NoProfile -Command". Note this will prevent any
-PowerShell environment setup by the profile from taking place.
+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
-setting 'shellcmdflag' to "-ExecutionPolicy RemoteSigned -Command". See
-online Windows documentation for more information on PowerShell Execution
-Policy settings.
+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 Windows PowerShell to your currently configured console codepage. The
+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)
+ 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.
+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:
diff --git a/runtime/doc/os_win32.txt b/runtime/doc/os_win32.txt
index 6c366083f6..3767cb8a98 100644
--- a/runtime/doc/os_win32.txt
+++ b/runtime/doc/os_win32.txt
@@ -30,6 +30,7 @@ File formats |dos-file-formats|
Interrupting |dos-CTRL-Break|
Temp files |dos-temp-files|
Shell option default |dos-shell|
+PowerShell defaults |dos-powershell|
Win32 GUI |gui-w32|