Show current vi mode in your zsh prompt

Having a brain damaged by prolonged use of vim I even use a vi input mode for my shell. I recently switched from bash to zsh and among other niceties zsh can show which vi mode I’m currently in and update this in real time as I switch. I found out how to do this from Aaron Toponce’s blog.

To have a VIMODE variable which is updated as you switch modes, add this to your ~/.zshrc:

You can then add $VIMODE to your prompt: