Add doas config stuff
This commit is contained in:
parent
b44c41f339
commit
3d17d60bc9
5 changed files with 97 additions and 6 deletions
.config/zsh/custom/plugins/doas
32
.config/zsh/custom/plugins/doas/doas.plugin.zsh
Normal file
32
.config/zsh/custom/plugins/doas/doas.plugin.zsh
Normal file
|
@ -0,0 +1,32 @@
|
|||
# ------------------------------------------------------------------------------
|
||||
# Description
|
||||
# -----------
|
||||
#
|
||||
# doas will be inserted before the command
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
# Authors
|
||||
# -------
|
||||
#
|
||||
# * Anatoly <akopyl@radner.ru>
|
||||
#
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
doas-command-line() {
|
||||
[[ -z $BUFFER ]] && LBUFFER="$(fc -ln -1)"
|
||||
if [[ $BUFFER == doas\ * ]]; then
|
||||
if [[ ${#LBUFFER} -le 4 ]]; then
|
||||
RBUFFER="${BUFFER#doas }"
|
||||
LBUFFER=""
|
||||
else
|
||||
LBUFFER="${LBUFFER#doas }"
|
||||
fi
|
||||
else
|
||||
LBUFFER="doas $LBUFFER"
|
||||
fi
|
||||
}
|
||||
zle -N doas-command-line
|
||||
# Defined shortcut keys: [Esc] [Esc]
|
||||
bindkey -M emacs '\e\e' doas-command-line
|
||||
bindkey -M vicmd '\e\e' doas-command-line
|
||||
bindkey -M viins '\e\e' doas-command-line
|
Loading…
Add table
Add a link
Reference in a new issue