Skip to content

Instantly share code, notes, and snippets.

@adam-zethraeus
Forked from tanzeeb/.zshrc
Created June 11, 2023 21:17
Show Gist options
  • Save adam-zethraeus/6a0bf305c0e8e68117c7923eef192d5d to your computer and use it in GitHub Desktop.
Save adam-zethraeus/6a0bf305c0e8e68117c7923eef192d5d 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
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
@adam-zethraeus
Copy link
Author

starship_render is no longer required, presumably because their hooks changed in the last 3 years.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment