view dot_config/private_fish/functions/fzf_last_command_output.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 6ab26ddbf78d
children
line wrap: on
line source

function fzf_last_command_output
    set cmd (history | fzf --header "Choose the command to rerun.")
    if test -n "$cmd"
        set result (eval $cmd | fzf -m --header "Choose the line(s) from the repeated command\'s output to paste into the current command-line. (The order matters!)")
        if test -n "$result"
            commandline -i (string join " " -- $result "") # adds a space after the inserted line output
        end
    end
    commandline -f repaint
end