mirror of
https://github.com/frebib/dotfiles.git
synced 2024-06-14 12:57:23 +00:00
Customise sudo plugin to fit my aliases
This commit is contained in:
parent
da62525a0b
commit
878b13b2fa
@ -4,11 +4,13 @@ sudo-command-line() {
|
|||||||
[[ -z $BUFFER ]] && zle up-history
|
[[ -z $BUFFER ]] && zle up-history
|
||||||
if [[ $BUFFER == sudo\ * ]]; then
|
if [[ $BUFFER == sudo\ * ]]; then
|
||||||
LBUFFER="${LBUFFER#sudo }"
|
LBUFFER="${LBUFFER#sudo }"
|
||||||
elif [[ $BUFFER == $EDITOR\ * ]]; then
|
elif [[ $BUFFER == $EDITOR\ * ]] || [[ $BUFFER == vi\ * ]]; then
|
||||||
LBUFFER="${LBUFFER#$EDITOR }"
|
LBUFFER="${LBUFFER#$EDITOR }"
|
||||||
LBUFFER="sudoedit $LBUFFER"
|
LBUFFER="${LBUFFER#vi }"
|
||||||
elif [[ $BUFFER == sudoedit\ * ]]; then
|
LBUFFER="svi $LBUFFER"
|
||||||
|
elif [[ $BUFFER == sudoedit\ * ]] || [[ $BUFFER == svi\ * ]]; then
|
||||||
LBUFFER="${LBUFFER#sudoedit }"
|
LBUFFER="${LBUFFER#sudoedit }"
|
||||||
|
LBUFFER="${LBUFFER#svi }"
|
||||||
LBUFFER="$EDITOR $LBUFFER"
|
LBUFFER="$EDITOR $LBUFFER"
|
||||||
else
|
else
|
||||||
LBUFFER="sudo $LBUFFER"
|
LBUFFER="sudo $LBUFFER"
|
||||||
|
Loading…
Reference in New Issue
Block a user