|
|
@ -96,20 +96,13 @@ if [[ -z $_fzf_git_cat ]]; then
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
__fzf_git_gen_header() {
|
|
|
|
|
|
|
|
printf "$1\n"
|
|
|
|
|
|
|
|
printf "%${#1}s\n" | tr ' ' '▔'
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_fzf_git_files() {
|
|
|
|
_fzf_git_files() {
|
|
|
|
_fzf_git_check || return
|
|
|
|
_fzf_git_check || return
|
|
|
|
(git -c color.status=always status --short
|
|
|
|
(git -c color.status=always status --short
|
|
|
|
git ls-files | grep -vf <(git status -s | grep '^[^?]' | cut -c4-) | sed 's/^/ /') |
|
|
|
|
git ls-files | grep -vf <(git status -s | grep '^[^?]' | cut -c4-) | sed 's/^/ /') |
|
|
|
|
_fzf_git_fzf -m --ansi --nth 2..,.. \
|
|
|
|
_fzf_git_fzf -m --ansi --nth 2..,.. \
|
|
|
|
--prompt '📁 Files> ' \
|
|
|
|
--prompt '📁 Files> ' \
|
|
|
|
--header "$(__fzf_git_gen_header 'CTRL-O (open in browser) ╱ CTRL-E (open in editor)')" \
|
|
|
|
|
|
|
|
--bind "ctrl-o:execute-silent:bash $__fzf_git file {-1}" \
|
|
|
|
--bind "ctrl-o:execute-silent:bash $__fzf_git file {-1}" \
|
|
|
|
--bind "ctrl-e:execute:${EDITOR:-vim} {-1} > /dev/tty" \
|
|
|
|
|
|
|
|
--preview "git diff --no-ext-diff --color=always -- {-1} | sed 1,4d; $_fzf_git_cat {-1}" |
|
|
|
|
--preview "git diff --no-ext-diff --color=always -- {-1} | sed 1,4d; $_fzf_git_cat {-1}" |
|
|
|
|
cut -c4- | sed 's/.* -> //'
|
|
|
|
cut -c4- | sed 's/.* -> //'
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -119,7 +112,6 @@ _fzf_git_branches() {
|
|
|
|
git branch -a --color=always | grep -v '/HEAD\s' | sort |
|
|
|
|
git branch -a --color=always | grep -v '/HEAD\s' | sort |
|
|
|
|
_fzf_git_fzf --ansi --tac --preview-window right,70% \
|
|
|
|
_fzf_git_fzf --ansi --tac --preview-window right,70% \
|
|
|
|
--prompt '🌵 Branches> ' \
|
|
|
|
--prompt '🌵 Branches> ' \
|
|
|
|
--header "$(__fzf_git_gen_header 'CTRL-O (open in browser)')" \
|
|
|
|
|
|
|
|
--bind "ctrl-o:execute-silent:bash $__fzf_git branch {}" \
|
|
|
|
--bind "ctrl-o:execute-silent:bash $__fzf_git branch {}" \
|
|
|
|
--preview 'git log --oneline --graph --date=short --color=always --pretty="format:%C(auto)%cd %h%d %s" $(sed s/^..// <<< {} | cut -d" " -f1)' |
|
|
|
|
--preview 'git log --oneline --graph --date=short --color=always --pretty="format:%C(auto)%cd %h%d %s" $(sed s/^..// <<< {} | cut -d" " -f1)' |
|
|
|
|
sed 's/^..//' | cut -d' ' -f1 |
|
|
|
|
sed 's/^..//' | cut -d' ' -f1 |
|
|
|
@ -131,7 +123,6 @@ _fzf_git_tags() {
|
|
|
|
git tag --sort -version:refname |
|
|
|
|
git tag --sort -version:refname |
|
|
|
|
_fzf_git_fzf --preview-window right,70% \
|
|
|
|
_fzf_git_fzf --preview-window right,70% \
|
|
|
|
--prompt '📛 Tags> ' \
|
|
|
|
--prompt '📛 Tags> ' \
|
|
|
|
--header "$(__fzf_git_gen_header 'CTRL-O (open in browser)')" \
|
|
|
|
|
|
|
|
--bind "ctrl-o:execute-silent:bash $__fzf_git tag {}" \
|
|
|
|
--bind "ctrl-o:execute-silent:bash $__fzf_git tag {}" \
|
|
|
|
--preview 'git show --color=always {}'
|
|
|
|
--preview 'git show --color=always {}'
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -141,9 +132,8 @@ _fzf_git_hashes() {
|
|
|
|
git log --date=short --format="%C(green)%C(bold)%cd %C(auto)%h%d %s (%an)" --graph --color=always |
|
|
|
|
git log --date=short --format="%C(green)%C(bold)%cd %C(auto)%h%d %s (%an)" --graph --color=always |
|
|
|
|
_fzf_git_fzf --ansi --no-sort --bind 'ctrl-s:toggle-sort' \
|
|
|
|
_fzf_git_fzf --ansi --no-sort --bind 'ctrl-s:toggle-sort' \
|
|
|
|
--prompt '🍡 Hashes> ' \
|
|
|
|
--prompt '🍡 Hashes> ' \
|
|
|
|
--header "$(__fzf_git_gen_header 'CTRL-O (open in browser) ╱ CTRL-S (toggle sort)')" \
|
|
|
|
|
|
|
|
--bind "ctrl-o:execute-silent:bash $__fzf_git commit {}" \
|
|
|
|
--bind "ctrl-o:execute-silent:bash $__fzf_git commit {}" \
|
|
|
|
--color hl:underline,hl+:underline \
|
|
|
|
--header 'Press CTRL-S to toggle sort' \
|
|
|
|
--preview 'grep -o "[a-f0-9]\{7,\}" <<< {} | xargs git show --color=always' |
|
|
|
|
--preview 'grep -o "[a-f0-9]\{7,\}" <<< {} | xargs git show --color=always' |
|
|
|
|
grep -o "[a-f0-9]\{7,\}"
|
|
|
|
grep -o "[a-f0-9]\{7,\}"
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -153,7 +143,6 @@ _fzf_git_remotes() {
|
|
|
|
git remote -v | awk '{print $1 "\t" $2}' | uniq |
|
|
|
|
git remote -v | awk '{print $1 "\t" $2}' | uniq |
|
|
|
|
_fzf_git_fzf --tac \
|
|
|
|
_fzf_git_fzf --tac \
|
|
|
|
--prompt '📡 Remotes> ' \
|
|
|
|
--prompt '📡 Remotes> ' \
|
|
|
|
--header "$(__fzf_git_gen_header 'CTRL-O (open in browser)')" \
|
|
|
|
|
|
|
|
--bind "ctrl-o:execute-silent:bash $__fzf_git remote {1}" \
|
|
|
|
--bind "ctrl-o:execute-silent:bash $__fzf_git remote {1}" \
|
|
|
|
--preview-window right,70% \
|
|
|
|
--preview-window right,70% \
|
|
|
|
--preview 'git log --oneline --graph --date=short --color=always --pretty="format:%C(auto)%cd %h%d %s" {1}/"$(git rev-parse --abbrev-ref HEAD)"' |
|
|
|
|
--preview 'git log --oneline --graph --date=short --color=always --pretty="format:%C(auto)%cd %h%d %s" {1}/"$(git rev-parse --abbrev-ref HEAD)"' |
|
|
|
@ -164,8 +153,6 @@ _fzf_git_stashes() {
|
|
|
|
_fzf_git_check || return
|
|
|
|
_fzf_git_check || return
|
|
|
|
git stash list | _fzf_git_fzf \
|
|
|
|
git stash list | _fzf_git_fzf \
|
|
|
|
--prompt '🥡 Stashes> ' \
|
|
|
|
--prompt '🥡 Stashes> ' \
|
|
|
|
--header "$(__fzf_git_gen_header 'CTRL-X (drop stash)')" \
|
|
|
|
|
|
|
|
--bind 'ctrl-x:execute-silent(git stash drop {1})+reload(git stash list)' \
|
|
|
|
|
|
|
|
-d: --preview 'git show --color=always {1}' |
|
|
|
|
-d: --preview 'git show --color=always {1}' |
|
|
|
|
cut -d: -f1
|
|
|
|
cut -d: -f1
|
|
|
|
}
|
|
|
|
}
|
|
|
|