Permalink
Browse files

Add ability to override using $EDITOR

  • Loading branch information...
tswicegood committed Nov 15, 2012
1 parent 20b3d43 commit 8c4ea4f5988b7d758be9f891943b2d3cfd2639e5
Showing with 15 additions and 11 deletions.
  1. +15 −11 aliases/available/git.aliases.bash
@@ -28,14 +28,18 @@ alias gdel='git branch -D'
alias gmu='git fetch origin -v; git fetch upstream -v; git merge upstream/master'
alias gll='git log --graph --pretty=oneline --abbrev-commit'
-case $OSTYPE in
- linux*)
- alias gd='git diff | vim -R -'
- ;;
- darwin*)
- alias gd='git diff | mate'
- ;;
- *)
- alias gd='git diff'
- ;;
-esac
+if [ -z "$EDITOR" ]; then
+ case $OSTYPE in
+ linux*)
+ alias gd='git diff | vim -R -'
+ ;;
+ darwin*)
+ alias gd='git diff | mate'
+ ;;
+ *)
+ alias gd='git diff'
+ ;;
+ esac
+else
+ alias gd="git diff | $EDITOR"
+fi

3 comments on commit 8c4ea4f

Owner

nwinkler replied Nov 16, 2012

Hi,

not sure about this one, maybe I'm simply missing something. I'm on OS X, don't have TextMate installed, so the $EDITOR override is nice. Unfortunately, it doesn't work, since my $EDITOR is set to vim. What I would really need is the Linux behavior, where vim is called with the additional dash to read from stdin.

How are you using the $EDITOR override?

Owner

tswicegood replied Nov 16, 2012

Ahh -- good point. I'm using subl -w which reads STDIN without anything extra. I wonder if this should be DIFF_EDITOR since EDITOR is already expected to behave a certain way?

Owner

nwinkler replied Nov 19, 2012

Probably makes sense, since it will not work for people who are using vim or plain vi.

Please sign in to comment.