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

Provide native Bash script for launching host gVim from WSL #6855

Open
BatmanAoD opened this issue Sep 3, 2020 · 2 comments
Open

Provide native Bash script for launching host gVim from WSL #6855

BatmanAoD opened this issue Sep 3, 2020 · 2 comments

Comments

@BatmanAoD
Copy link

Recent Windows Insider builds break gvim.bat when launched from WSL2 (bug report). Even prior to this change, though, invoking gvim.bat correctly from within WSL2 was tricky and error-prone (here was my attempt).

Running the native Windows gVim from WSL is helpful for editing WSL files in a GUI editor without configuring x11 forwarding (WSL does not yet have any way to use native Windows graphics).

A native Bash launcher script provided as an optional component of the Windows installer would be helpful. Just like gvim.bat, it could have a hardcoded path to the Vim directory. Here is a script that I've written, which could be used as the basis for an "official" script.

@chrisbra
Copy link
Member

chrisbra commented Sep 4, 2020

not sure I follow (and I did not understand the wsl2 bug report). Is there a reason, you cannot put $VIM in your $PATH and just call gvim.exe directly?

@BatmanAoD
Copy link
Author

@chrisbra Yes. gvim.bat serves two purposes:

  • It lives in \Windows, which is always on the path, and has the Vim installation path hardcoded by the installer itself. This avoids needing to search through the Program Files directories for the latest Vim version. Note that $VIM is not set by default in either Windows or WSL.
  • The native Windows gvim.exe does not actually fork, so gvim.bat looks for the --nofork argument and, if it is not present, uses the start built-in (part of cmd.exe) to fork the process.

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