fix terminal cursor

This commit is contained in:
TheK4n 2023-01-09 20:58:09 +03:00
parent a4fecb61a4
commit b5d7b831c9

View File

@ -23,13 +23,14 @@ bindkey -v
zle-keymap-select() { zle-keymap-select() {
if [[ ${KEYMAP} == vicmd ]] || if [[ ${KEYMAP} == vicmd ]] ||
[[ $1 = 'block' ]]; then [[ $1 = 'block' ]]; then
echo -ne '\e[1 q' echo -ne '\e[2 q'
elif [[ ${KEYMAP} == main ]] || elif [[ ${KEYMAP} == main ]] ||
[[ ${KEYMAP} == viins ]] || [[ ${KEYMAP} == viins ]] ||
[[ ${KEYMAP} = '' ]] || [[ ${KEYMAP} = '' ]] ||
[[ $1 = 'beam' ]]; then [[ $1 = 'beam' ]]; then
echo -ne '\e[5 q' echo -ne '\e[5 q'
fi fi
} }
@ -38,11 +39,22 @@ zle -N zle-keymap-select
# Use beam shape cursor on startup. # Use beam shape cursor on startup.
echo -ne '\e[5 q' echo -ne '\e[5 q'
# Use beam shape cursor for each new prompt. _fix_cursor() {
preexec() {
echo -ne '\e[5 q' echo -ne '\e[5 q'
} }
precmd_functions+=(_fix_cursor)
# Set cursor style (DECSCUSR), VT520.
# 0 -> blinking block.
# 1 -> blinking block (default).
# 2 -> steady block.
# 3 -> blinking underline.
# 4 -> steady underline.
# 5 -> blinking bar, xterm.
# 6 -> steady bar, xterm.
bindkey -M viins 'jk' vi-cmd-mode bindkey -M viins 'jk' vi-cmd-mode
bindkey ' ' magic-space # do history expansion on space bindkey ' ' magic-space # do history expansion on space