view dot_config/private_fish/functions/fzf_hg_stack.fish @ 1044:fb4670b7526a

feat: replicate push-line function from zsh source: https://github.com/fish-shell/fish-shell/issues/7800#issuecomment-792915764
author Zeger Van de Vannet <zeger@vandevan.net>
date Thu, 02 May 2024 08:48:33 +0200
parents 979735a38885
children
line wrap: on
line source

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