Thanks and credit to mattn and ferreus on GitHub.
Check out wslpath if you're using the Windows Subsystem for Linux.
| #!/bin/bash | |
| # wrapper to convert linux paths to windows | |
| # so vscode will work as a git editor with cygwin | |
| # editor="/home/this/file.sh -w" in .gitconfig | |
| # extract last argument (the file path) | |
| for last; do true; done | |
| # get all the initial command arguments | |
| all="${@:1:$(($#-1))}" | |
| # launch editor with windows path | |
| code $all `cygpath -w $last` |