Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vim filter with WSL2 is unavailable #7100

Closed
dpsigor opened this issue Sep 21, 2021 · 1 comment
Closed

Vim filter with WSL2 is unavailable #7100

dpsigor opened this issue Sep 21, 2021 · 1 comment

Comments

@dpsigor
Copy link

dpsigor commented Sep 21, 2021

Is your feature request related to a problem? Please describe.
I wish to filter commands available in my default WSL2 shell, instead of filtering through PowerShell.

Describe the solution you'd like
One possible solution is to parse cmd args | cmd2 args2 into wsl cmd args | wsl cmd2 args2. In this case, no configs like bashrc are loaded.
Another possible solution, a better one, is to use the integrated terminal.

Additional context

Vim:
image
image

VSCodeVim:
image
image
As in, sh is not a recognized PowerShell command.

Filter commands were implemented with #5042.

@tagniam
Copy link
Contributor

tagniam commented Oct 2, 2021

Hi @dpsigor, thanks for bringing this up. I'm testing some code that would involve allowing custom shells for filter commands as a VSCodeVim setting.

You'll then simply just need to add "vim.shell": "<path to WSL2 shell>" to your settings.json and your ! commands will use the WSL2 shell. I'll try and make a PR soon.

Another possible solution, a better one, is to use the integrated terminal.

I investigated this initially, but unfortunately VSCode doesn't offer a public API to get the output from an integrated terminal command, so redirecting output from an integrated terminal into the buffer is not possible without being very hacky.

They do have a proposed API vscode.window.onDidWriteTerminalData(), but turns out published extensions on the VSCode Marketplace cannot use such proposed APIs.

J-Fields pushed a commit that referenced this issue Nov 13, 2021
Refactors `externalCommand.ts` to use event emitters instead of temporary files to read the command output into the Vim buffer. This is much more cross-platform friendly. Creating temporary files and file paths are OS-dependent, which has made it difficult to build a `vim.shell` setting for #7100... so instead, this PR lets `exec`'s event emitters handle reading stdout/stderr for us.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants