Created
May 1, 2013 16:15
-
-
Save Ajedi32/5496276 to your computer and use it in GitHub Desktop.
Add this to your `~/.bashrc` file to enable the use of the `subl` command on your Git Bash prompt on Windows. (It may work with other shells as well, but I've only tested this with Git Bash on Windows and bash on Ubuntu.) Note that this command not only supports file input, but also simulates support for piped input as well. ```
Usage: subl file…
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
# Enable the use of the `subl` command | |
subl () { | |
subl_path='C:\Program Files\Sublime Text 2\sublime_text.exe' | |
if test -t 0 | |
then | |
"$subl_path" $* | |
else | |
timestamp=`date +%s` | |
filename=$1 | |
shift | |
if [ -z $filename ]; then filename=".temp$timestamp" ; fi | |
touch "$filename" | |
while read data | |
do | |
echo "$data" >> "$filename" | |
done | |
"$subl_path" "$filename" $* | |
sleep 1 | |
rm "$filename" | |
fi | |
} |
Thanks for sharing, works well on my Ubuntu.
Thanks much! Works like a charm on Win7+MinGW/MSYS. Just set subl_path='sublime_text' along with Sublime Text install dir. in PATH.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for sharing! This worked well for piping output to Sublime Text on Linux Mint command line. I only had to change the executable path to
subl_path='sublime-text'
, and wola! I can dogit diff /path/to/file | subl
.