-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
14b736e
commit d7917ce
Showing
3 changed files
with
17 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
# fish-sudo | ||
Oh-my-zsh sudo plugin for fish. Modified from https://www.manueluberti.eu/programming/2018/10/27/sudo-fish/ | ||
Oh-my-zsh sudo plugin for fish. Modified from https://www.manueluberti.eu/programming/2018/10/27/sudo-fish/. | ||
|
||
Press Ctrl+s to prepend sudo to your current command line, or if the command line | ||
is blank prepend it to the previous command in the history. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Prepend sudo with e-e | ||
bind \cs 'prepend_sudo' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
function prepend_sudo | ||
set -l cmd (commandline) | ||
if test -z "$cmd" | ||
commandline -r $history[1] | ||
end | ||
|
||
set -l old_cursor (commandline -C) | ||
commandline -C 0 | ||
commandline -i "sudo " | ||
commandline -C (math $old_cursor + 5) | ||
end |