diff dot_config/private_fish/functions/fzf_last_command_output.fish @ 1038:6ab26ddbf78d

feat: add fish shell
author Zeger Van de Vannet <zeger@vandevan.net>
date Fri, 26 Apr 2024 18:43:22 +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_last_command_output.fish	Fri Apr 26 18:43:22 2024 +0200
@@ -0,0 +1,10 @@
+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