diff dot_config/private_fish/functions/push_input.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
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dot_config/private_fish/functions/push_input.fish	Thu May 02 08:48:33 2024 +0200
@@ -0,0 +1,11 @@
+function push-input
+    set -g --prepend pushed_input (commandline | string collect)
+    commandline -r ""
+end
+
+function pop-input --on-event fish_postexec
+    if test -n "$pushed_input[1]"
+        commandline -r -- $pushed_input[1]
+        set -g --erase pushed_input[1]
+    end
+end