From b42841802d1d80cb2125a0a1bd87a2006dfdbe58 Mon Sep 17 00:00:00 2001 From: David Morgan Date: Tue, 22 Nov 2022 12:17:26 +0000 Subject: Use fzf-git.sh --- fzf-git/functions.sh | 52 ------------------------------------------------- fzf-git/key-binding.zsh | 19 ------------------ 2 files changed, 71 deletions(-) delete mode 100644 fzf-git/functions.sh delete mode 100644 fzf-git/key-binding.zsh (limited to 'fzf-git') diff --git a/fzf-git/functions.sh b/fzf-git/functions.sh deleted file mode 100644 index c1f6fb7..0000000 --- a/fzf-git/functions.sh +++ /dev/null @@ -1,52 +0,0 @@ -# GIT heart FZF -# ------------- - -is_in_git_repo() { - git rev-parse HEAD > /dev/null 2>&1 -} - -fzf-down() { - fzf --height 50% "$@" --border -} - -_gf() { - is_in_git_repo || return - git -c color.status=always status --short | - fzf-down -m --ansi --nth 2..,.. \ - --preview '(git diff --color=always -- {-1} | sed 1,4d; cat {-1}) | head -500' | - cut -c4- | sed 's/.* -> //' -} - -_gb() { - is_in_git_repo || return - git branch -a --color=always | grep -v '/HEAD\s' | sort | - fzf-down --ansi --multi --tac --preview-window right:70% \ - --preview 'git log --oneline --graph --date=short --color=always --pretty="format:%C(auto)%cd %h%d %s" $(sed s/^..// <<< {} | cut -d" " -f1) | head -'$LINES | - sed 's/^..//' | cut -d' ' -f1 | - sed 's#^remotes/##' -} - -_gt() { - is_in_git_repo || return - git tag --sort -version:refname | - fzf-down --multi --preview-window right:70% \ - --preview 'git show --color=always {} | head -'$LINES -} - -_gh() { - is_in_git_repo || return - git log --date=short --format="%C(green)%C(bold)%cd %C(auto)%h%d %s (%an)" --graph --color=always | - fzf-down --ansi --no-sort --reverse --multi --bind 'ctrl-s:toggle-sort' \ - --header 'Press CTRL-S to toggle sort' \ - --preview 'grep -o "[a-f0-9]\{7,\}" <<< {} | xargs git show --color=always | head -'$LINES | - grep -o "[a-f0-9]\{7,\}" -} - -_gr() { - is_in_git_repo || return - git remote -v | awk '{print $1 "\t" $2}' | uniq | - fzf-down --tac \ - --preview 'git log --oneline --graph --date=short --pretty="format:%C(auto)%cd %h%d %s" {1} | head -200' | - cut -d$'\t' -f1 -} - diff --git a/fzf-git/key-binding.zsh b/fzf-git/key-binding.zsh deleted file mode 100644 index e44052e..0000000 --- a/fzf-git/key-binding.zsh +++ /dev/null @@ -1,19 +0,0 @@ -join-lines() { - local item - while read item; do - echo -n "${(q)item} " - done -} - -bind-git-helper() { - local c - for c in $@; do - eval "fzf-g$c-widget() { local result=\$(_g$c | join-lines); zle reset-prompt; LBUFFER+=\$result }" - eval "zle -N fzf-g$c-widget" - eval "bindkey '^g^$c' fzf-g$c-widget" - done -} -bindkey -r "^g" -bindkey "^g^g" send-break -bind-git-helper f b t r h -unset -f bind-git-helper -- cgit 1.4.1-2-gfad0