[vim/vim] Allow compound commands with 'system()' when 'shell' is 'pwsh' (PR #19401)

1 view
Skip to first unread message

tiamat18

unread,
Feb 13, 2026, 9:13:37 PM (21 hours ago) Feb 13
to vim/vim, Subscribed

When the 'shell' option was set to 'powershell' or 'pwsh' and the 'system()' vimscript function was called with an argument containing two or more shell commands (delimited by ';' or '&'), the function would always fail with 'E282'.

The cause of the error was that VIM would wrap the shell command string with parentheses (to allow the entire output to be redirected to a temporary file for capturing) before actually passing it to the PowerShell process for execution.

Unlike the typical shell that uses parentheses to group commands (and possibly spawn a subshell), PowerShell uses them to resolve a single command (pipeline) to an expression. To group multiple commands with PowerShell, you must instead wrap them with either the subexpression operator '$(...)' or an immediately evaluated script block '& { ... }'. The latter option may be more efficient since it does not buffer its output like for the former one does.


You can view, comment on, or merge this pull request online at:

  https://github.com/vim/vim/pull/19401

Commit Summary

  • e5c0be0 Allow compound commands with 'system()' when 'shell' is 'pwsh'

File Changes

(3 files)

Patch Links:


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/19401@github.com>

Reply all
Reply to author
Forward
0 new messages