From 9d2e2b0b262825943b047a43a511f9381127e545 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Wed, 17 Aug 2022 20:26:03 +0900 Subject: [PATCH] Bindings and headers --- README.md | 1 + fzf-git.sh | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ef5b04a..82e23ff 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,7 @@ Customization _fzf_git_fzf() { fzf-tmux -p80%,60% -- \ --layout=reverse --multi --height=50% --min-height=20 --border \ + --color='header:italic:underline' \ --preview-window='right,50%,border-left' \ --bind='ctrl-/:change-preview-window(down,50%,border-top|hidden|)' "$@" } diff --git a/fzf-git.sh b/fzf-git.sh index 483a89c..da08f6f 100644 --- a/fzf-git.sh +++ b/fzf-git.sh @@ -72,6 +72,7 @@ if [[ $- =~ i ]]; then _fzf_git_fzf() { fzf-tmux -p80%,60% -- \ --layout=reverse --multi --height=50% --min-height=20 --border \ + --color='header:italic:underline' \ --preview-window='right,50%,border-left' \ --bind='ctrl-/:change-preview-window(down,50%,border-top|hidden|)' "$@" } @@ -102,7 +103,9 @@ _fzf_git_files() { git ls-files | grep -vf <(git status -s | grep '^[^?]' | cut -c4-) | sed 's/^/ /') | _fzf_git_fzf -m --ansi --nth 2..,.. \ --prompt '📁 Files> ' \ + --header $'CTRL-O (open in browser) ╱ CTRL-E (open in editor)\n\n' \ --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}" | cut -c4- | sed 's/.* -> //' } @@ -112,6 +115,7 @@ _fzf_git_branches() { git branch -a --color=always | grep -v '/HEAD\s' | sort | _fzf_git_fzf --ansi --tac --preview-window right,70% \ --prompt '🌵 Branches> ' \ + --header $'CTRL-O (open in browser)\n\n' \ --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)' | sed 's/^..//' | cut -d' ' -f1 | @@ -123,6 +127,7 @@ _fzf_git_tags() { git tag --sort -version:refname | _fzf_git_fzf --preview-window right,70% \ --prompt '📛 Tags> ' \ + --header $'CTRL-O (open in browser)\n\n' \ --bind "ctrl-o:execute-silent:bash $__fzf_git tag {}" \ --preview 'git show --color=always {}' } @@ -132,8 +137,10 @@ _fzf_git_hashes() { 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' \ --prompt '🍡 Hashes> ' \ + --header $'CTRL-O (open in browser) ╱ CTRL-D (diff) ╱ CTRL-S (toggle sort)\n\n' \ --bind "ctrl-o:execute-silent:bash $__fzf_git commit {}" \ - --header 'Press CTRL-S to toggle sort' \ + --bind 'ctrl-d:execute:grep -o "[a-f0-9]\{7,\}" <<< {} | xargs git diff > /dev/tty' \ + --color hl:underline,hl+:underline \ --preview 'grep -o "[a-f0-9]\{7,\}" <<< {} | xargs git show --color=always' | grep -o "[a-f0-9]\{7,\}" } @@ -143,6 +150,7 @@ _fzf_git_remotes() { git remote -v | awk '{print $1 "\t" $2}' | uniq | _fzf_git_fzf --tac \ --prompt '📡 Remotes> ' \ + --header $'CTRL-O (open in browser)\n\n' \ --bind "ctrl-o:execute-silent:bash $__fzf_git remote {1}" \ --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)"' | @@ -153,6 +161,8 @@ _fzf_git_stashes() { _fzf_git_check || return git stash list | _fzf_git_fzf \ --prompt '🥡 Stashes> ' \ + --header $'CTRL-X (drop stash)\n\n' \ + --bind 'ctrl-x:execute-silent(git stash drop {1})+reload(git stash list)' \ -d: --preview 'git show --color=always {1}' | cut -d: -f1 }