Merge f103a880ea
into dca1803ced
This commit is contained in:
commit
07d469aecc
1 changed files with 17 additions and 0 deletions
|
@ -120,3 +120,20 @@ fi
|
|||
mkcd() {
|
||||
[[ -n ${1} ]] && mkdir -p ${1} && builtin cd ${1}
|
||||
}
|
||||
|
||||
# Inserts 'doas ' or 'sudo ' at the beginning of a line.
|
||||
function prepend-sudoas {
|
||||
if [[ "$BUFFER" != (doas|su(do|))\ * ]]; then
|
||||
if [[ $OSTYPE == openbsd* ]]; then
|
||||
BUFFER="doas $BUFFER"
|
||||
else
|
||||
BUFFER="sudo $BUFFER"
|
||||
fi
|
||||
(( CURSOR += 5 ))
|
||||
fi
|
||||
}
|
||||
zle -N prepend-sudoas
|
||||
|
||||
# Defined shortcut keys: [Esc] [Esc]
|
||||
bindkey "\e!" prepend-sudoas
|
||||
|
||||
|
|
Loading…
Reference in a new issue