Created
April 20, 2023 12:49
-
-
Save lorenzleutgeb/2c76e24f15ea70d4f1102bbd5111d4e2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:: The first argument is always "-C", since | |
:: External Editor Revived thinks that this | |
:: process is bash. | |
set target=%2 | |
:: The following two lines can be used to | |
:: convert the argument to a WSL path. | |
::set target=%target:\\=/% | |
::set target=%target:C:=/mnt/c% | |
:: Unescape backslashes in path. | |
set target=%target:\\=/% | |
:: For debugging, echo the target path to vim. | |
::wt wsl bash -c "echo \""%target%\"" | vim" | |
:: Use vim inside WSL and Windows Terminal. | |
:: This currently does not work because | |
:: Windows Terminal won't wait for vim | |
:: to exit. | |
:: See https://github.com/microsoft/terminal/issues/8856 | |
::wt wsl vim %target% | |
:: An editor that should always be available for debugging. | |
::notepad %target% | |
:: Touch the file, so that saving with VS Code vim | |
:: does not complain about ENONT. | |
::copy nul %target% | |
:: Run VS Code. | |
code --reuse-window --wait %target% |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment