This adds bash-history-esque !! and !$ bindings to fish shell (and the substitution is immediate, which is neat)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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