Saturday, October 1, 2022

Re: [PATCH] fix: powershell :! filter commands

[cc'ing vim-dev]

Enan Ajmain wrote:

> Problem: filtered bang commands with powershell as `:set shell` doesn't
> work. The command structure followed in `make_filter_cmd` is wrong. Try
> `:%!sort` on any file to reproduce the bug.
>
> Solution: Fix the command for the powershell in `make_filter_cmd`.
>
> This is not a proper patch. It comes originally from my neovim PR. I
> just wanted to see if it would work in vim. It does.
>
> I'm not sending it to vim-dev@googlegroups.com because it's not a proper
> patch: I haven't added any tests; haven't changed the docs or the
> default config sources. I'm hoping someone in the dev team, who at least
> sometimes works with a Windows machine, will take it up and police it.
>
> Here are the configurations for `:set shell=pwsh` this patch worked on:
>
> let &shellcmdflag = "-Command"
> let &shellredir = "2>&1 | Out-File -Encoding default %s; exit $LastExitCode"
> let &shellpipe = "2>&1 | Out-File -Encoding default %s; exit $LastExitCode"
> let &shellquote = ""
> let &shellxquote = "\""

Thanks for looking into this.

Would be good if this can be turned into a PR. Hopefully with a test.
Can you do that, or would this need to be done by someone else?
Then it's easier for others to comment and suggest improvements.

--
hundred-and-one symptoms of being an internet addict:
240. You think Webster's Dictionary is a directory of WEB sites.

/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20221001144740.0FF911C065C%40moolenaar.net.

No comments: