-
-
Save adam-zethraeus/6a0bf305c0e8e68117c7923eef192d5d to your computer and use it in GitHub Desktop.
vi-mode cursors with zsh + starship
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
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
starship_render
is no longer required, presumably because their hooks changed in the last 3 years.