zsh: don't change cursor style on linux TTY

This commit is contained in:
tastytea 2022-09-01 20:49:26 +02:00
parent 26dadff7f2
commit 07e242e06b
Signed by: tastytea
SSH Key Fingerprint: SHA256:FBkvrOlhq5use1XEttyUGT4bUTDVA1ar9SgIc9P03cM

View File

@ -30,14 +30,12 @@ key[Backspace]=${terminfo[kbs]}
# Finally, make sure the terminal is in application mode, when zle is
# active. Only then are the values from $terminfo valid.
function zle-line-init () {
if [[ "${TERM}" != "linux" ]] && [[ "${TERM}" != "dumb" ]]
then
if [[ "${TERM}" != "linux" ]] && [[ "${TERM}" != "dumb" ]]; then
echoti smkx
fi
}
function zle-line-finish () {
if [[ "${TERM}" != "linux" ]] && [[ "${TERM}" != "dumb" ]]
then
if [[ "${TERM}" != "linux" ]] && [[ "${TERM}" != "dumb" ]]; then
echoti smkx
fi
}
@ -45,14 +43,19 @@ function zle-line-finish () {
# Change cursor based on mode
print -n '\e[6 q'
function zle-keymap-select() {
if [[ "${KEYMAP}" == "viins" || "${KEYMAP}" == "main" ]]; then
print -n '\e[6 q' # beam
else
print -n '\e[2 q' # block
if [[ "${TERM}" != "linux" ]] && [[ "${TERM}" != "dumb" ]]; then
if [[ "${KEYMAP}" == "viins" || "${KEYMAP}" == "main" ]]; then
print -n '\e[6 q' # beam
else
print -n '\e[2 q' # block
fi
fi
}
function _fixcursor() {
print -n '\e[6 q'
if [[ "${TERM}" != "linux" ]] && [[ "${TERM}" != "dumb" ]]; then
print -n '\e[6 q'
# print -n "\e]12;magenta\007"
fi
}
add-zsh-hook precmd _fixcursor