Instantly share code, notes, and snippets.

What would you like to do?
fish shell function to emulate zsh's push-line feature := store the current command and run one in between - restore the last command afterwards
# Save this file to ~/.config/fish/functions/
# Bind the function by using this in ~/.config/fish/functions/
# function fish_user_key_bindings
# # For example alt+q
# bind \eq push-line
# end
function push-line
set cl (commandline)
commandline -f repaint
if test -n (string join $cl)
set -g fish_buffer_stack $cl
commandline ''
commandline -f repaint
function restore_line -e fish_postexec
commandline $fish_buffer_stack
functions -e restore_line
set -e fish_buffer_stack
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment