Skip to content

Instantly share code, notes, and snippets.

@musm
Forked from nickbudi/README.md
Last active July 4, 2020 03:46
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save musm/d2a0ddbee068dc89246e716d1c8a9d04 to your computer and use it in GitHub Desktop.
Cygwin git compatibility with VS Code (or other Windows programs) using cygpath

Cygwin Git + VS Code compatibility

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`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment