From 82be622a09808e0567ef18d3a560a9cd7437a29e Mon Sep 17 00:00:00 2001 From: Christopher Apple Date: Sat, 2 Nov 2019 21:08:34 -0600 Subject: [PATCH] stash working Former-commit-id: e0dadacdfea374993feb8426bddd942bba0f6e50 --- forgit.plugin.fish | 29 +++++++++++++++-------------- forgit.plugin.zsh | 2 ++ 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/forgit.plugin.fish b/forgit.plugin.fish index b4815e6..5e871b3 100755 --- a/forgit.plugin.fish +++ b/forgit.plugin.fish @@ -26,7 +26,7 @@ function forgit::log set opts " $FORGIT_FZF_DEFAULT_OPTS +s +m --tiebreak=index --preview=\"$cmd\" - --bind=\"enter:execute($cmd |LESS='-R' less)\" + --bind=\"enter:execute($cmd |env LESS='-R' less)\" --bind=\"ctrl-y:execute-silent(echo {} |grep -Eo '[a-f0-9]+' | head -1 | tr -d '\n' | pbcopy)\" $FORGIT_LOG_FZF_OPTS " @@ -119,22 +119,23 @@ function forgit::restore echo 'Nothing to restore.' end -## git stash viewer -#forgit::stash::show() { -# forgit::inside_work_tree || return 1 -# set cmd "git stash show \$(echo {}| cut -d: -f1) --color=always --ext-diff $forgit_fancy" -# set opts" -# $FORGIT_FZF_DEFAULT_OPTS -# +s +m -0 --tiebreak=index --preview=\"$cmd\" --bind=\"enter:execute($cmd |LESS='-R' less)\" -# $FORGIT_STASH_FZF_OPTS -# " -# git stash list | env FZF_DEFAULT_OPTS="$opts" fzf -#} +# git stash viewer +function forgit::stash::show + forgit::inside_work_tree || return 1 + set cmd "git stash show \$(echo {}| cut -d: -f1) --color=always --ext-diff $forgit_fancy" + set opts " + $FORGIT_FZF_DEFAULT_OPTS + +s +m -0 --tiebreak=index --preview=\"$cmd\" --bind=\"enter:execute($cmd |env LESS='-R' less)\" + $FORGIT_STASH_FZF_OPTS + " + git stash list | env FZF_DEFAULT_OPTS="$opts" fzf +end + # ## git clean selector #forgit::clean() { # forgit::inside_work_tree || return 1 -# set opts" +# set opts " # $FORGIT_FZF_DEFAULT_OPTS # -m -0 # $FORGIT_CLEAN_FZF_OPTS @@ -155,7 +156,7 @@ end # # https://github.com/sharkdp/bat.git # hash bat > /dev/null 2>&1 && cat='bat -l gitignore --color=always' || cat="cat" # set cmd "$cat $FORGIT_GI_TEMPLATES/{2}{,.gitignore} 2>/dev/null" -# set opts" +# set opts " # $FORGIT_FZF_DEFAULT_OPTS # -m --preview=\"$cmd\" --preview-window='right:70%' # $FORGIT_IGNORE_FZF_OPTS diff --git a/forgit.plugin.zsh b/forgit.plugin.zsh index 40ae1eb..877f872 100755 --- a/forgit.plugin.zsh +++ b/forgit.plugin.zsh @@ -4,6 +4,8 @@ forgit::warn() { printf "%b[Warn]%b %s\n" '\e[0;33m' '\e[0m' "$@" >&2; } forgit::info() { printf "%b[Info]%b %s\n" '\e[0;32m' '\e[0m' "$@" >&2; } forgit::inside_work_tree() { git rev-parse --is-inside-work-tree >/dev/null; } +dumb dumb dumb test + # https://github.com/so-fancy/diff-so-fancy hash diff-so-fancy &>/dev/null && forgit_fancy='|diff-so-fancy' # https://github.com/wfxr/emoji-cli