Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MatrixManAtYrService/8ba56e957c861719691105e52592ee62 to your computer and use it in GitHub Desktop.
Save MatrixManAtYrService/8ba56e957c861719691105e52592ee62 to your computer and use it in GitHub Desktop.
# 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