git add fuzzy

This commit is contained in:
Noah Masur 2020-11-25 23:03:52 -05:00
parent 23c84ca606
commit 7970d36fa9

View File

@ -36,6 +36,22 @@ function gittools
and git show $commit
end
function git-add-fuzzy
set gitfile (git status -s \
| fzf \
--height 50% \
-m \
--preview-window right:70% \
--preview 'set -l IFS; set gd (git diff --color=always (echo {} | awk \'{$1=$1};1\' | cut -d" " -f2)); if test "$gd"; echo "$gd"; else; bat (echo {} | awk \'{$1=$1};1\' | cut -d" " -f2); end')
and for gf in $gitfile
set gf (echo $gf \
| awk '{$1=$1};1' \
| cut -d' ' -f2 \
)
and git add $gf
end
end
function git-merge-fuzzy
set branch (git-fuzzy-branch "merge from...")
and git merge $branch
@ -56,6 +72,8 @@ function gittools
switch $argv[1]
case "checkout"
git-checkout-fuzzy
case "add"
git-add-fuzzy
case "show"
git-show-fuzzy
case "merge"