Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: In Vi mode, show whether "insert" or "command" state is active
25.12.2014, 07:16, "Jason Spiro" <jasonspiro4@xxxxxxxxx>:
> On Mon, Dec 22, 2014 at 1:44 PM, ZyX <kp-pav@xxxxxxxxx> wrote:
>> And this should be changed prompt/rprompt, not changing
>> cursor because changing cursor shape is less likely to work
>
> OK. You could do things the same way Bash's brand-new
> 'show-mode-in-prompt' feature does things: you could add one extra
> character to the beginning of the prompt. A colon in vicmd mode; a
> plus sign in viins mode.
>
> This should work reliably in every terminal emulator.
I have read that this is readline 6.3 feature that has nothing to do with bash except that bash is using readline. Also [vicmd]/[viins] variant is clearer then colon and plus and also in case of %z one should not assume only vicmd/viins: zle is not as limited as readline and theoretically allows any number of modes (have never seen them actually implemented though).
---
Also regarding %z minimal implementation: in my example code $KEYMAP is checked for being an alias to something. Most likely your variant will make %z disappear in `viins` mode (as it is linked to main and if I am not mistaking exiting vicmd will bring up the main keymap) and in my variant it definitely (I have tested this with `zsh -f`) will show either `vicmd` or `viins` effectively avoiding changing prompt width which may be confusing.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author