Thanks to @dougblackio’s article Adding Vi To Your Zsh, I have this awesome vi mode indicator in my zsh.

vi mode indicator in zsh

Unfortunately, I found that I had to type bindkey -v every time I started a new shell to get this to work. After some research here, I figured out I needed to add precmd() { RPROMPT="" } to my .zshrc. That resolved the issue.

I also removed @dougblackio’s custom git status code with this final result:

bindkey -v

bindkey '^P' up-history
bindkey '^N' down-history
bindkey '^?' backward-delete-char
bindkey '^h' backward-delete-char
bindkey '^w' backward-kill-word
bindkey '^r' history-incremental-search-backward

precmd() { RPROMPT="" }
function zle-line-init zle-keymap-select {
   VIM_PROMPT="%{$fg_bold[yellow]%} [% NORMAL]%  %{$reset_color%}"
   RPS1="${${KEYMAP/vicmd/$VIM_PROMPT}/(main|viins)/} $EPS1"
   zle reset-prompt

zle -N zle-line-init
zle -N zle-keymap-select


Run this command to automatically install this script into ~/.zshrc

curl >> ~/.zshrc