Skip to main content

Vi mode

Whatโ€‹

Display the current ZSH Vi mode (insert / normal / visual โ€ฆ) in the prompt. Useful when using bindkey -v so you can tell at a glance which mode you are in.

caution

This segment is currently only supported in ZSH. Adding it to your configuration will automatically register a zle-keymap-select hook that re-renders the prompt every time the keymap changes.

Sample Configurationโ€‹

{
"type": "vimode",
"style": "plain",
"foreground": "#ffffff",
"background": "#0077c2",
"template": " {{ if eq .Mode \"normal\" }}๏ญ NORMAL{{ else if eq .Mode \"visual\" }}๏‰… VISUAL{{ else }}๏€ INSERT{{ end }} "
}

Template (info)โ€‹

default template
{{ .Mode }}

Propertiesโ€‹

NameTypeDescription
.Modestringthe normalized mode: insert, normal, visual, viopp, replace, or the raw keymap when unmapped
.Keymapstringthe raw $KEYMAP value reported by ZSH (e.g. main, viins, vicmd, visual, viopp)