how to update RPROMPT each time a key is pressed
Trevor Avant <[email protected]>
| Newsgroups | gmane.comp.shells.zsh.devel,gmane.comp.shells.zsh.user |
|---|---|
| Message-ID | <CADpHffGDx_sczwp9BH7-exv6KgAigOi1HXbTPuSk=-6F=PrkFQ@mail.gmail.com> |
I am trying to create a function that updates RPROMPT when I have typed "cd
.." into the terminal. Here is the code that I added to my .zshrc as an
attempt to make this work:
function self-insert() {
zle .self-insert
if [[ $BUFFER == "cd .." ]]; then
RPROMPT="ABC"
zle reset-prompt
fi
}
zle -N self-insert
The effect of this command is that my RPROMPT gets set to ABC, but only
after I have executed the command, rather than once I have typed the
command. However, if I were to update RBUFFER in that if-statement, then it
would get updated once I have typed the command. So I would like to make
RPROMPT get updated like RBUFFER would.