make my zsh prompt show setting in vi setting

I make use of bindkey -v (for bash-ers set -o vi I assume that operate in zsh also) or vi (m) setting. yet it pests me that I do not have any kind of aesthetic sign to inform me whether I'm in insert setting or command setting. Does any person recognize just how I can make my prompt display screen the setting?

2019-05-06 21:51:12
Source Share
Answers: 3

you can attempt VimMode

2019-05-08 20:02:00

I located this using SU. Below's the standard instance, though I'm still tailoring it for myself :

function zle-line-init zle-keymap-select {
    RPS1="${${KEYMAP/vicmd/-- NORMAL --}/(main|viins)/-- INSERT --}"
    zle reset-prompt

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

I would certainly clarify it other than I do not actually recognize it yet

2019-05-08 11:33:27

You've currently located zle-keymap-select which is implemented whenever the setting adjustments. You can utilize it to set a few other aesthetic indication than the prompt, relying on what your incurable sustains it (and also your preference in setting indication display screen, certainly).

There is a typical terminfo capability to transform the form of the arrow. Nonetheless some terminals present the very same arrow in both settings. Xterm's idea of a much less noticeable arrow is to make it blink (and also this have to be made it possible for with the -bc command line argument or cursorBlink source).

zle-keymap-select () {
  case $KEYMAP in
    vicmd) print -rn -- $terminfo[cvvis];; # block cursor
    viins|main) print -rn -- $terminfo[cnorm];; # less visible cursor

With some terminals, you can additionally transform the arrow shade with print -n '\e]12;pink\a' (by shade name) or print -n '\e]12;#abcdef\a' (by RGB requirements). These series are defined in the xterm documents, in the ctlseqs documents ; modern-day incurable emulators commonly mimic xterm, though they could not sustain all its attributes.

2019-05-08 08:54:22