vim / vim

The official Vim repository

Home Page:https://www.vim.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support for PowerShell 5.1 on Windows not working as documented

sevehub opened this issue · comments

Steps to reproduce

Open Vim with: vim --clean -c "set shell=powershell"
Run the command: :set shellcmdflag
Command output: shellcmdflag=/c
Expected: shellcmdflag=-Command

Expected behaviour

According to the VIM documentation (:h powershell), specific options should be set automatically if 'shell' includes "powershell" in the filename at startup. The expected behavior is for VIM to set shellcmdflag, shellxquote options to the following values:

  • shellcmdflag: -Command
  • shellxquote: "

However, it has been observed that when the shell is set to powershell, the shellcmdflag option (nor shellxquote) does not update accordingly and remains unchanged.

Version of Vim

VIM - Vi IMproved 9.0 (2022 Jun 28) MS-Windows 64-bit console version Included patches: 1-49

Environment

Windows 10/ Windows terminal

Logs and stack traces

No response

vim --clean -c "set shell=powershell"

That is too late, by that time the shell has been already initialized to cmd.exe and once the shell setting was set, Vim does not reset the various shell parameters anymore.

Try either:

set COMSPEC=powershell.exe
vim --clean

or alternatively: vim --clean --cmd ':set shell=powershell'