From b5d7b831c9d0c79c559d326e322a4558f1cac2b0 Mon Sep 17 00:00:00 2001 From: TheK4n Date: Mon, 9 Jan 2023 20:58:09 +0300 Subject: [PATCH] fix terminal cursor --- sub/zsh/options | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/sub/zsh/options b/sub/zsh/options index 5933bad..5f9f3a7 100644 --- a/sub/zsh/options +++ b/sub/zsh/options @@ -23,13 +23,14 @@ bindkey -v zle-keymap-select() { if [[ ${KEYMAP} == vicmd ]] || [[ $1 = 'block' ]]; then - echo -ne '\e[1 q' + echo -ne '\e[2 q' elif [[ ${KEYMAP} == main ]] || [[ ${KEYMAP} == viins ]] || [[ ${KEYMAP} = '' ]] || [[ $1 = 'beam' ]]; then echo -ne '\e[5 q' + fi } @@ -38,11 +39,22 @@ zle -N zle-keymap-select # Use beam shape cursor on startup. echo -ne '\e[5 q' -# Use beam shape cursor for each new prompt. -preexec() { +_fix_cursor() { 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 ' ' magic-space # do history expansion on space