vi-mode.zsh 510 B

12345678910111213
  1. # Indicate if ZLE is in vicmd mode/keymap.
  2. VIMODE_INDICATOR="$cBold${FG[2]}NORMAL$cReset"
  3. function vimode() {
  4. # Display indicator if the keymap is 'vicmd', otherwise nothing.
  5. echo "${${KEYMAP/vicmd/$VIMODE_INDICATOR}/(main|viins)/}"
  6. }
  7. # Refresh the prompt each keymap change, to show/hide the vicmd indicator.
  8. function zle-keymap-select {
  9. zle reset-prompt # Re-expand the prompts.
  10. zle -R # Redisplay the command line.
  11. }
  12. zle -N zle-keymap-select # Special Widget: called when keymap changes.