Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
This adds bash-history-esque !! and !$ bindings to fish shell (and the substitution is immediate, which is neat)
# put these in ~/.config/fish/functions/fish_user_key_bindings.fish
function bind_bang
switch (commandline -t)
case "!"
commandline -t $history[1]
commandline -f repaint
case "*"
commandline -i !
end
end
function bind_dollar
switch (commandline -t)
case "!"
commandline -t ""
commandline -f history-token-search-backward
case "*"
commandline -i '$'
end
end
function fish_user_key_bindings
bind ! bind_bang
bind '$' bind_dollar
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment