diff dot_config/private_fish/functions/fzf_hg_stack.fish @ 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
children
line wrap: on
line diff
--- /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