Created
October 13, 2018 17:18
-
-
Save MatrixManAtYrService/8ba56e957c861719691105e52592ee62 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Cursor shape switch based on mode: | |
# https://unix.stackexchange.com/questions/547/make-my-zsh-prompt-show-mode-in-vi-mode | |
KEYTIMEOUT=5 | |
function zle-keymap-select { | |
if [[ ${KEYMAP} == vicmd ]] || | |
[[ $1 = 'block' ]]; then | |
echo -ne '\e[1 q' | |
elif [[ ${KEYMAP} == main ]] || | |
[[ ${KEYMAP} == viins ]] || | |
[[ ${KEYMAP} = '' ]] || | |
[[ $1 = 'beam' ]]; then | |
echo -ne '\e[5 q' | |
fi | |
} | |
zle -N zle-keymap-select | |
# Use beam shape cursor for each new prompt. | |
make_beam() { | |
echo -ne '\e[5 q' | |
} | |
# Do so now | |
make_beam | |
# And at the start of each prompt | |
autoload -U add-zsh-hook | |
add-zsh-hook preexec make_beam |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment