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

Re: Duplicating TRANSIENT_RPROMPT for left PROPMT?



On Oct 25, 10:50am, Jesse Hathaway wrote:
}
} I tried the zle -M approach, but it seemed to result in my cursor sometimes
} being at the bottom of the output, and them sometimes the vim_mode prompt
} appearing, i.e. my cursor was jumping up and down.
} 
} I ended up adding a preexec which solves the problem:
} 
} # Clear vim_mode prompt before executing command, as the command output
} will be
} # written to same line as the vim_mode prompt on the terminal
} function preexec {
}   echo -n "$terminfo[el]"
} }

Here's another possibility I should have thought of before:

---- 8< ----
PS1='%~ '
vim_ins_mode=$'\n'"-- INSERT --"
vim_cmd_mode=""

zle-keymap-select() {
  vim_mode="${${KEYMAP/vicmd/${vim_cmd_mode}}/(main|viins)/${vim_ins_mode}}"
  POSTDISPLAY=$vim_mode
  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
---- 8< ----

I think this solves all the problems so far discussed.



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