Unlike bash, fish even expands it in place, allowing you to make changes.
``` function sudo if test "$argv" = !! eval command sudo $history[1] else command sudo $argv end end ```
This works for `sudo !!`
https://github.com/srynot4sale/dotfiles/blob/master/fish/fun...
Only one more key press than "sudo !" :)
but similarly, fish user for the last 2+ years.
In fish Alt+Up does something similar, but repeated presses iterates over all words of all commands rather than last words of bash commands. A big improvement is you can type some chars first and then Alt+Up only gets words matching this substring — like Up but word granularity! (Closest bash key is Ctrl+Alt+I)
If you don't mind the differences, and want Alt+. muscle memory to work in fish too, do:
bind \e. history-token-search-backward
(plus Alt+Up doesn't work for me in linux console, Alt+. does)