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โ
- json
- yaml
- toml
{
"type": "vimode",
"style": "plain",
"foreground": "#ffffff",
"background": "#0077c2",
"template": " {{ if eq .Mode \"normal\" }}๏ญ NORMAL{{ else if eq .Mode \"visual\" }}๏
VISUAL{{ else }}๏ INSERT{{ end }} "
}
type: vimode
style: plain
foreground: "#ffffff"
background: "#0077c2"
template: ' {{ if eq .Mode "normal" }}๏ญ NORMAL{{ else if eq .Mode "visual" }}๏
VISUAL{{ else }}๏ INSERT{{ end }} '
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โ
| Name | Type | Description |
|---|---|---|
.Mode | string | the normalized mode: insert, normal, visual, viopp, replace, or the raw keymap when unmapped |
.Keymap | string | the raw $KEYMAP value reported by ZSH (e.g. main, viins, vicmd, visual, viopp) |