changeset 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 3395b4109688
children 7db5c9c8016f
files dot_config/private_fish/config.fish dot_config/private_fish/functions/push_input.fish
diffstat 2 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/dot_config/private_fish/config.fish	Thu May 02 08:41:10 2024 +0200
+++ b/dot_config/private_fish/config.fish	Thu May 02 08:48:33 2024 +0200
@@ -30,5 +30,8 @@
     # Select revisions from the stack
     bind \ek fzf_hg_stack
 
+    # Push current cmdline input to the stack
+    bind \eq push-input
+
     abbr hgst hg status
 end
--- /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