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

Re: Duplicating TRANSIENT_RPROMPT for left PROPMT?



On Thu, Oct 31, 2013 at 10:09 AM, Bart Schaefer
<schaefer@xxxxxxxxxxxxxxxx>wrote:

> On Oct 31,  9:07am, Jesse Hathaway wrote:
> }
> } I tried grabbing the latest tarball from the website and compiling it,
> but
>
> I wouldn't have expected this to be a problem that would fix anyway ...


I thought it was a long shot, I just wanted to make sure debian had not
added some strange patch.

} the results are the same:
> }
> } ~| /usr/local/bin/zsh -x
> } +/home/jhathaway/.zshrc:1> PS1='%~ '
> } +/home/jhathaway/.zshrc:2> vim_ins_mode='
> } -- INSERT --'
> } +/home/jhathaway/.zshrc:3> vim_cmd_mode='
> } -- COMMAND --'
> } +/home/jhathaway/.zshrc:10> zle -N zle-keymap-select
> } +/home/jhathaway/.zshrc:11> zle -N zle-line-init zle-keymap-select
> } +/home/jhathaway/.zshrc:20> zle -N zle-line-finish
>
>
> Let's try "zsh -v" instead of "zsh -x" so we can see the function
> definitions.
>

~| /usr/local/bin/zsh -v
set -o vi
PS1='%~ '
vim_ins_mode=$'\n'"-- INSERT --"
vim_cmd_mode=$'\n'"-- COMMAND --"

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

zle-line-finish() {
  if [[ -n $POSTDISPLAY ]]
  then
    POSTDISPLAY=''
    zle redisplay
  fi
}
zle -N zle-line-finish
~

Also, how are you choosing whether to be in vi mode or emacs mode?  The
> default is emacs mode, unless you have EDITOR=vi in the environment or
> something.
>

Using the EDITOR environment variable, I also tried setting it explicitly
with `set -o vi`

Try editing the zle-keymap-select function to put the actual keymap name
> into POSTDISPLAY, e.g.
>
>   POSTDISPLAY="$vim_mode $KEYMAP"


see above.

Thanks, Jesse


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