patch 8.2.3071: shell options are not set properly for PowerShell

Problem:    Shell options are not set properly for PowerShell.
Solution:   Use better option defaults. (Mike Willams, closes #8459)
This commit is contained in:
Mike Williams
2021-06-28 20:53:58 +02:00
committed by Bram Moolenaar
parent ffec6dd16a
commit 127950241e
9 changed files with 206 additions and 49 deletions

View File

@ -17,6 +17,7 @@ versions of Vim. Also see |os_win32.txt| and |os_msdos.txt|.
7. Interrupting |dos-CTRL-Break|
8. Temp files |dos-temp-files|
9. Shell option default |dos-shell|
10. PowerShell |dos-powershell|
==============================================================================
1. File locations *dos-locations*
@ -297,8 +298,46 @@ For Win32 as:
<shell> -c "command name >file"
For DOS 32 bit, DJGPP does this internally somehow.
When starting up, Vim checks for the presence of "sh" anywhere in the 'shell'
option. If it is present, Vim sets the 'shellcmdflag' and 'shellquote' or
'shellxquote' options will be set as described above.
When starting up, if Vim does not recognise a standard Windows shell it checks
for the presence of "sh" anywhere in the 'shell' option. If it is present,
Vim sets the 'shellcmdflag' and 'shellquote' or 'shellxquote' options will be
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: