Skip to content

Instantly share code, notes, and snippets.

@cmalard
Forked from versedi/.sh
Last active February 13, 2019 20:23
Show Gist options
  • Save cmalard/16c58869319c9a88473ec08cc7989c6b to your computer and use it in GitHub Desktop.
Save cmalard/16c58869319c9a88473ec08cc7989c6b to your computer and use it in GitHub Desktop.
Cygwin + Sublime Text 3 : works with files and Git
#!/bin/bash
# To create in [.babun/]cygwin/usr/local/bin/subl with chmod +x
ARGS=""
while test $# -gt 0
do
ARGS="$ARGS ${1#/cygdrive/[a-zA-Z]}"; # Remove /cygdrive and disk letter from the path
shift
done
/cygdrive/c/Program\ Files/Sublime\ Text\ 3/subl.exe $ARGS
@cmalard
Copy link
Author

cmalard commented Oct 14, 2016

I ran into this same strange thing, probably because it is used by Cygwin.
What you can do: delete the old file, then you can create it again.

@jfonte
Copy link

jfonte commented May 7, 2017

@cmalard this worked beautifully! Much obliged for this!

@jherax
Copy link

jherax commented Mar 14, 2018

Thanks @cmalard, It works good for git commands such as git rebase -i HEAD~3,
but when I try to open a file,
e.g. subl ~/.zshrc, it opens in the wrong path:

Expected:
C:\cygwin64\home\myuser\.zshrc

Actual (wrong):
C:\home\myuser\.zshrc

Another example:
subl /usr/local/bin/test

Expected:
C:\cygwin64\usr\local\bin\test

Actual (wrong):
C:\usr\local\bin\test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment