From e7cba5ec6fb24efc7c22343b964754cd5adeb90f Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Fri, 5 Aug 2016 02:37:45 +0300 Subject: [PATCH] .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. --- .gitconfig | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) 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 -- 2.39.5