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.
https://github.com/vim/vim/pull/19401
(3 files)
—
Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.![]()