refactored some stuff
This commit is contained in:
parent
d31941c80c
commit
b1cbc649cc
11 changed files with 445 additions and 56 deletions
20
zsh/files/sudo.zsh
Normal file
20
zsh/files/sudo.zsh
Normal file
|
@ -0,0 +1,20 @@
|
|||
sudo-command-line() {
|
||||
[[ -z $BUFFER ]] && zle up-history
|
||||
if [[ $BUFFER == sudo\ * ]]; then
|
||||
LBUFFER="${LBUFFER#sudo }"
|
||||
elif [[ $BUFFER == $EDITOR\ * ]]; then
|
||||
LBUFFER="${LBUFFER#$EDITOR }"
|
||||
LBUFFER="sudoedit $LBUFFER"
|
||||
elif [[ $BUFFER == sudoedit\ * ]]; then
|
||||
LBUFFER="${LBUFFER#sudoedit }"
|
||||
LBUFFER="$EDITOR $LBUFFER"
|
||||
else
|
||||
LBUFFER="sudo $LBUFFER"
|
||||
fi
|
||||
}
|
||||
|
||||
zle -N sudo-command-line
|
||||
|
||||
# Defined shortcut keys: [Esc] [Esc]
|
||||
bindkey "\e\e" sudo-command-line
|
||||
bindkey -M vicmd '\e\e' sudo-command-line
|
Loading…
Add table
Add a link
Reference in a new issue