-
-
Save b-/981892a65837ab0a387e to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# Add this to your ~/.config/fish/config.fish | |
# Syntax: | |
# To just rerun your last command, simply type '!!' | |
# This forked version supports "sudo !!" via two functions. | |
function !! | |
eval $history[1] $argv | |
end function | |
function sudo | |
if test $argv | |
if test $argv = "!!" | |
eval /usr/bin/sudo $history[1] | |
else | |
eval /usr/bin/sudo $argv | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Would be a good idea to modify the command in history, replacing
!!
with the original command.As it stands:
A more realistic case when this might occur would be repeated execution of the last command - if you can only do it once then you'd be better off with up+return in your muscle memory than use this
!!
function.