Skip to content

Instantly share code, notes, and snippets.

@tanzeeb
Created September 4, 2020 21:53
Show Gist options
  • Save tanzeeb/49b501bd62c84b11cc64a4def1c7c15b to your computer and use it in GitHub Desktop.
Save tanzeeb/49b501bd62c84b11cc64a4def1c7c15b to your computer and use it in GitHub Desktop.
vi-mode cursors with zsh + starship
eval "$(starship init zsh)"
function _cursor_block() { echo -ne '\e[1 q' }
function _cursor_bar() { echo -ne '\e[3 q' }
function _cursor_beam() { echo -ne '\e[5 q' }
function zle-keymap-select zle-line-init
{
case $KEYMAP in
vicmd) _cursor_block;;
viins|main) _cursor_beam;;
*) _cursor_bar;;
esac
starship_render
zle reset-prompt
zle -R
}
function zle-line-finish
{
_cursor_block
}
zle -N zle-line-init
zle -N zle-line-finish
zle -N zle-keymap-select
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment