Created
September 4, 2020 21:53
-
-
Save tanzeeb/49b501bd62c84b11cc64a4def1c7c15b 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 | |
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