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" 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) |
@echo off | |
REM wrapper to convert linux paths to windows | |
REM so vscode git integration will work with cygwin | |
REM "git.path"="C:\\this\\file.bat" in settings.json | |
setlocal | |
set PATH=C:\tools\cygwin\bin;%PATH% | |
if "%1" equ "rev-parse" goto rev_parse | |
git %* | |
goto :eof | |
:rev_parse | |
for /f %%1 in ('git %*') do cygpath -w %%1 |