From 0839c647e6f39cd8ee0db60e15ff60bf076fee0a Mon Sep 17 00:00:00 2001 From: Von Random Date: Wed, 19 Apr 2017 14:22:59 +0300 Subject: [PATCH] add gdf magic to zshrc --- zshrc | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/zshrc b/zshrc index a005f79..957e51a 100644 --- a/zshrc +++ b/zshrc @@ -112,6 +112,21 @@ bindkey '^R' history-incremental-search-backward # ctrl + r bindkey '^[m' copy-prev-shell-word # alt + m bindkey -s '^j' '^atime ^m' # ctrl + j # }}} +# {{{ functions +gdiff() { /usr/bin/git diff --color "$@"; } +gdf() +{ + local fancydiff='/usr/bin/diff-so-fancy' + local githighlight='/usr/share/git/diff-highlight/diff-highlight' + if [[ -x ${fancydiff} ]]; then + gdiff "$@" | ${fancydiff} | less --tabs=4 -RSFX + elif [[ -x ${githighlight} ]]; then + gdiff "$@" | ${githighlight} | less --tabs=4 -RSFX + else + gdiff "$@" + fi +} +# }}} # {{{ aliases alias less='command less -R' alias ltail='command less -R +F' @@ -181,13 +196,6 @@ fi alias rscreen='command screen -Dr' alias scr='command screen sudo -Es' # }}} -# {{{ plugins and traps -#plugins="${HOME}/.bashplugins" -#[[ -r "${plugins}" && "$BASH_VERSINFO" -ge 4 ]] && . "${plugins}" -# -## we want to see exit code on error (it also has to be the last entry here) -#trap 'printf "${red}>>${reset} ${bold}exit${reset} ${red}%s${reset}\n" "$?" >&2' ERR -# }}} # {{{ global aliases alias -g L='| less -R' alias -g H='| head'