From: Oleg Broytman Date: Thu, 4 Aug 2016 23:37:45 +0000 (+0300) Subject: .gitconfig: use `git var GIT_EDITOR` X-Git-Url: https://git.phdru.name/?p=dotfiles.git;a=commitdiff_plain;h=e7cba5ec6fb24efc7c22343b964754cd5adeb90f .gitconfig: use `git var GIT_EDITOR` `git var GIT_EDITOR` is better than ${VISUAL:-${EDITOR:-vi}} because it takes into account all variables: GIT_EDITOR, VISUAL and EDITOR, and falls back to the platform's default. --- diff --git a/.gitconfig b/.gitconfig index 583b9c7..90aab8c 100644 --- a/.gitconfig +++ b/.gitconfig @@ -107,17 +107,17 @@ grep-all = !"f() { git rev-list --all | xargs git grep \"$@\"; }; f" # Edit all files of the given type - edit-cached = !"f() { git ls-files --cached | sort -u ; }; \"${VISUAL:-${EDITOR:-vi}}\" `f`" - edit-deleted = !"f() { git ls-files --deleted | sort -u ; }; \"${VISUAL:-${EDITOR:-vi}}\" `f`" - edit-others = !"f() { git ls-files --others | sort -u ; }; \"${VISUAL:-${EDITOR:-vi}}\" `f`" - edit-ignored = !"f() { git ls-files --ignored | sort -u ; }; \"${VISUAL:-${EDITOR:-vi}}\" `f`" - edit-killed = !"f() { git ls-files --killed | sort -u ; }; \"${VISUAL:-${EDITOR:-vi}}\" `f`" - edit-modified = !"f() { git ls-files --modified | sort -u ; }; \"${VISUAL:-${EDITOR:-vi}}\" `f`" - edit-stage = !"f() { git ls-files --stage | cut -f2 | sort -u ; }; "${VISUAL:-${EDITOR:-vi}}" `f`" + edit-cached = !"f() { git ls-files --cached | sort -u ; }; `git var GIT_EDITOR` `f`" + edit-deleted = !"f() { git ls-files --deleted | sort -u ; }; `git var GIT_EDITOR` `f`" + edit-others = !"f() { git ls-files --others | sort -u ; }; `git var GIT_EDITOR` `f`" + edit-ignored = !"f() { git ls-files --ignored | sort -u ; }; `git var GIT_EDITOR` `f`" + edit-killed = !"f() { git ls-files --killed | sort -u ; }; `git var GIT_EDITOR` `f`" + edit-modified = !"f() { git ls-files --modified | sort -u ; }; `git var GIT_EDITOR` `f`" + edit-stage = !"f() { git ls-files --stage | cut -f2 | sort -u ; }; `git var GIT_EDITOR` `f`" # Editing and adding conflicted files: when we get many merge conflicts # and want to quickly solve them using an editor, then add the files. - edit-unmerged = !"f() { git ls-files --unmerged | cut -f2 | sort -u ; }; "${VISUAL:-${EDITOR:-vi}}" `f`" + edit-unmerged = !"f() { git ls-files --unmerged | cut -f2 | sort -u ; }; `git var GIT_EDITOR` `f`" add-unmerged = !"f() { git ls-files --unmerged | cut -f2 | sort -u ; }; git add `f`" # Get the current branch name