George Rawlinson
51e5d74b70
sudoedit isn't available on all systems. sometimes we don't want to use $EDITOR. or it is not set.
18 lines
368 B
Bash
18 lines
368 B
Bash
#
|
|
# sudo will be inserted before the current command
|
|
#
|
|
|
|
sudo-command-line() {
|
|
[[ -z $BUFFER ]] && zle up-history
|
|
if [[ $BUFFER == sudo\ * ]]; then
|
|
LBUFFER="${LBUFFER#sudo }"
|
|
else
|
|
LBUFFER="sudo $LBUFFER"
|
|
fi
|
|
}
|
|
|
|
zle -N sudo-command-line
|
|
# defined shortcut keys: [Esc] [Esc]
|
|
bindkey "\e\e" sudo-command-line
|
|
|
|
# vim: ft=zsh expandtab tabstop=2 shiftwidth=2
|