66 lines
1.3 KiB
Plaintext
66 lines
1.3 KiB
Plaintext
|
|
# Activate vim mode.
|
|
bindkey -v
|
|
|
|
bindkey -M viins 'jf' vi-cmd-mode
|
|
|
|
bindkey -M visual 'jf' vi-cmd-mode
|
|
bindkey -M visual 'i' vi-insert
|
|
bindkey -M visual 'a' vi-add-next
|
|
|
|
bindkey ' ' magic-space
|
|
|
|
bindkey '^K' up-line-or-history # C-k
|
|
bindkey -M vicmd '^K' up-line-or-history # C-k
|
|
|
|
bindkey '^J' down-line-or-history # C-j
|
|
bindkey -M vicmd '^J' down-line-or-history # C-j
|
|
|
|
bindkey '^U' kill-whole-line # C-u
|
|
bindkey -M vicmd '^U' kill-whole-line # C-u
|
|
|
|
bindkey -M viins '\e.' insert-last-word # M-.
|
|
|
|
bindkey '^[[Z' reverse-menu-complete # S-Tab
|
|
|
|
|
|
insert-sudo() {
|
|
local sudo_template="${SUDO:=sudo} "
|
|
local template_len="${#sudo_template}"
|
|
|
|
if [ -z "${LBUFFER}${RBUFFER}" ]; then
|
|
zle up-history
|
|
fi
|
|
if [ "${LBUFFER::$template_len}" = "$sudo_template" ]; then
|
|
LBUFFER="${LBUFFER:$template_len}"
|
|
else
|
|
LBUFFER="${sudo_template}${LBUFFER}"
|
|
fi
|
|
}
|
|
|
|
zle -N insert-sudo
|
|
|
|
bindkey -M vicmd '^S' insert-sudo # C-s
|
|
bindkey -M viins '^S' insert-sudo # C-s
|
|
|
|
bindkey '`' autosuggest-accept
|
|
bindkey '^?' backward-delete-char
|
|
bindkey '^W' backward-delete-word
|
|
|
|
|
|
popdquiet() {
|
|
popd &>/dev/null
|
|
zle reset-prompt
|
|
}
|
|
zle -N popdquiet
|
|
bindkey "^P" popdquiet
|
|
bindkey -M vicmd "^P" popdquiet
|
|
|
|
|
|
cddotdot() {
|
|
cd ..
|
|
zle reset-prompt
|
|
}
|
|
zle -N cddotdot
|
|
bindkey "^O" cddotdot
|
|
bindkey -M vicmd "^O" cddotdot |