feat: change from emacs mode to vi mode
This commit is contained in:
@@ -30,8 +30,34 @@ setopt HIST_REDUCE_BLANKS
|
|||||||
setopt HIST_VERIFY
|
setopt HIST_VERIFY
|
||||||
setopt INC_APPEND_HISTORY_TIME
|
setopt INC_APPEND_HISTORY_TIME
|
||||||
|
|
||||||
# Emacs mode
|
###########
|
||||||
bindkey -e
|
# Vi mode #
|
||||||
|
###########
|
||||||
|
|
||||||
|
bindkey -v
|
||||||
|
export KEYTIMEOUT=1 # Reduce ESC delay to 10ms
|
||||||
|
bindkey -v '^?' backward-delete-char # Make backspace work in vi insert mode
|
||||||
|
bindkey -v '^H' backward-delete-char # Alternative backspace binding
|
||||||
|
bindkey -a '_' vi-first-non-blank
|
||||||
|
|
||||||
|
# Selection highlight
|
||||||
|
# shellcheck disable=SC2034
|
||||||
|
zle_highlight=(region:bg=#323641)
|
||||||
|
|
||||||
|
# Change cursor shape based on vi mode
|
||||||
|
function zle-keymap-select {
|
||||||
|
if [[ ${KEYMAP} == main ]]; then
|
||||||
|
echo -ne '\e[5 q' # Beam cursor for insert mode
|
||||||
|
elif [[ ${KEYMAP} == vicmd ]]; then
|
||||||
|
echo -ne '\e[1 q' # Block cursor for command mode
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
zle -N zle-keymap-select
|
||||||
|
|
||||||
|
function zle-line-init {
|
||||||
|
echo -ne '\e[5 q' # Beam cursor for insert mode
|
||||||
|
}
|
||||||
|
zle -N zle-line-init
|
||||||
|
|
||||||
###################
|
###################
|
||||||
# Shell Variables #
|
# Shell Variables #
|
||||||
|
|||||||
Reference in New Issue
Block a user