Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Duplicating TRANSIENT_RPROMPT for left PROPMT?



On Oct 22,  4:22pm, Jesse Hathaway wrote:
}
} The unusual part of my prompt is the vi mode at the bottom of my screen.
} Does anyone have thoughts on the best way to clear the prompt before the
} command is entered?

The best solution to this is to NOT put the vi mode in the prompt, but
instead use "zle -M" to display it.  Simplest way is like this:

PS1='%~ '
vim_ins_mode="-- INSERT --"
vim_cmd_mode=""

function zle-keymap-select {
  vim_mode="${${KEYMAP/vicmd/${vim_cmd_mode}}/(main|viins)/${vim_ins_mode}}"
  zle -M -- "$vim_mode"
}
zle -N zle-keymap-select
zle -N zle-line-init zle-keymap-select


Of course if you're already doing other stuff in zle-line-init you'll need
to tweak this, e.g., call zle-keymap-select from zle-line-init.


This and your original scheme both seem to suffer from the problem that
any completion listing covers up the "mode message" and it doesn't return
until you toggle through command/insert again.



Messages sorted by: Reverse Date, Date, Thread, Author