-
-
Save ctataryn/6bc5242752833872ddb883c2562fb31d to your computer and use it in GitHub Desktop.
A script that lets you execute gVim for Windows within WSL
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
#!/bin/bash | |
################################################################# | |
# place this script on your $PATH and chmod it to be executable | |
################################################################# | |
# assumes C:\ is mounted to /c, change any occurance of /c to /mnt/c if | |
# you are using the default WSL mount point for C:\ | |
CMD='/c/Windows/System32/cmd.exe' | |
#location of gvim | |
GVIM='/c/Program Files (x86)/Vim/vim81/gvim.exe' | |
FILE=`realpath "${1:-.}"` | |
if [[ $FILE == /c/* ]] ; | |
then | |
FILE=${FILE/\/c\//C:\\} | |
else | |
# replace the first forward slash | |
FILE=${FILE/\//\\\\wsl\$\\Ubuntu\\} | |
fi | |
# replace the rest | |
FILE=${FILE//\//\\} | |
echo Launch gvim for file: $FILE | |
`"$GVIM" $FILE` & |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment