summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Sima <bsima@groq.com>2022-11-15 07:33:34 -0800
committerBen Sima <bsima@groq.com>2024-04-17 13:01:43 -0700
commitc4122ad8383fc234cec8aefa86705970f20af2ab (patch)
treec7bf448fbd3b67ba4a6b5c5006329c3c02fb5dba
parentafb5e136f1a4b74de6656c49baab59cfcc4d1aa5 (diff)
add C-g C-p for interactively selecting stg patches
-rw-r--r--lib/common.nix12
1 files changed, 11 insertions, 1 deletions
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"'