mirror of
https://github.com/fish-shell/fish-shell
synced 2024-11-14 08:58:01 +00:00
Add default \es keybinding for "prepend sudo"
This commit is contained in:
parent
e5fc8abefe
commit
0f802eaad8
2 changed files with 11 additions and 0 deletions
8
share/functions/__fish_prepend_sudo.fish
Normal file
8
share/functions/__fish_prepend_sudo.fish
Normal file
|
@ -0,0 +1,8 @@
|
|||
function __fish_prepend_sudo -d "Prepend 'sudo ' to the beginning of the current commandline"
|
||||
set -l cmd (commandline -boc)
|
||||
if test "$cmd[1]" != "sudo"
|
||||
commandline -C 0
|
||||
commandline -i "sudo "
|
||||
commandline -f end-of-line
|
||||
end
|
||||
end
|
|
@ -93,6 +93,9 @@ function __fish_shared_key_bindings -d "Bindings shared between emacs and vi mod
|
|||
bind --preset $argv \ed 'set -l cmd (commandline); if test -z "$cmd"; echo; dirh; commandline -f repaint; else; commandline -f kill-word; end'
|
||||
bind --preset $argv \cd delete-or-exit
|
||||
|
||||
# Prepend 'sudo ' to the current commandline
|
||||
bind --preset $argv \es __fish_prepend_sudo
|
||||
|
||||
# Allow reading manpages by pressing F1 (many GUI applications) or Alt+h (like in zsh).
|
||||
bind --preset $argv -k f1 __fish_man_page
|
||||
bind --preset $argv \eh __fish_man_page
|
||||
|
|
Loading…
Reference in a new issue