changeset 1041:979735a38885

feat: add keybind with fzf selector for revisions from current stack
author Zeger Van de Vannet <zeger@vandevan.net>
date Tue, 30 Apr 2024 22:34:09 +0200
parents ea090c39e480
children aa5a077e8680
files dot_config/private_fish/config.fish dot_config/private_fish/functions/fzf_hg_stack.fish
diffstat 2 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/dot_config/private_fish/config.fish	Mon Apr 29 18:33:04 2024 +0200
+++ b/dot_config/private_fish/config.fish	Tue Apr 30 22:34:09 2024 +0200
@@ -21,6 +21,8 @@
     bind \eg fzf_hg_status_files
     # Select output lines from last command
     bind \er fzf_last_command_output
+    # Select revisions from the stack
+    bind \ek fzf_hg_stack
 
     abbr hgst hg status
 end
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dot_config/private_fish/functions/fzf_hg_stack.fish	Tue Apr 30 22:34:09 2024 +0200
@@ -0,0 +1,11 @@
+function fzf_hg_stack
+    set -l result (hg stack | fzf --ansi -m --header "Select the revsion(s)" --preview "echo {} | sed -rn 's/[[:space:]]*(s[[:digit:]]+).*/\1/p' | xargs hg diff --color=always -c" )
+    if test -n "$result"
+        set -l revs
+        for rev in $result
+            set revs $revs (echo $rev | sed -rn 's/[[:space:]]*(s[[:digit:]]+).*/\1/p')
+        end
+        commandline -i (string join " " -- $revs "")
+    end
+    commandline -f repaint
+end