From c4122ad8383fc234cec8aefa86705970f20af2ab Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Tue, 15 Nov 2022 07:33:34 -0800 Subject: add C-g C-p for interactively selecting stg patches --- lib/common.nix | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/common.nix b/lib/common.nix index a16d2da..a46dbc2 100644 --- a/lib/common.nix +++ b/lib/common.nix @@ -383,7 +383,10 @@ in { fzf_down() { fzf --height 50% --min-height 20 --border \ - --bind 'ctrl-/:change-preview-window(hidden|90%|)' "$@" + --bind 'ctrl-/:change-preview-window(hidden|90%|)' \ + --bind 'pgup:preview-page-up' \ + --bind 'pgdn:preview-page-down' \ + "$@" } _gf() { @@ -394,6 +397,12 @@ in { cut -c4- | sed 's/.* -> //' } + _gp() { + is_in_git_repo || return + stg series | + fzf_down -m --ansi --preview 'stg show -O --color=always {2}' + } + _gb() { is_in_git_repo || return git branch -a --color=always | grep -v '/HEAD\s' | sort | @@ -429,6 +438,7 @@ in { } bind '"\er": redraw-current-line' bind '"\C-g\C-f": "$(_gf)\e\C-e\er"' + bind '"\C-g\C-p": "$(_gp)\e\C-e\er"' bind '"\C-g\C-b": "$(_gb)\e\C-e\er"' bind '"\C-g\C-t": "$(_gt)\e\C-e\er"' bind '"\C-g\C-h": "$(_gh)\e\C-e\er"' -- cgit v1.2.3