Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: getting zle vi-modes to show the current mode
- X-seq: zsh-users 10986
- From: "Matt Wozniski" <godlygeek@xxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: getting zle vi-modes to show the current mode
- Date: Wed, 15 Nov 2006 00:30:54 -0500
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=D1tNPaara4W33SyDXgLI+4lVzuytgGHz5EIV4b0s5XfWH3rcKknWZSx+mk22NA191GnO/cfCWQFJhxRMnHiRQwhDcEEuMnYeeYIxqIPFQJJv+oLrPQ4dDQyLmt04cCvmVtZdJIQ3UscaPFgw4FhXngZLAkwR6tg2xcQ/euIVz7c=
- In-reply-to: <061114111310.ZM20545@xxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <17393e3e0611131127h75caa46es184b80fe17f13c49@xxxxxxxxxxxxxx> <061114111310.ZM20545@xxxxxxxxxxxxxxxxxxxxxx>
- Reply-to: mjw@xxxxxxxxxx
For the purpose of the archives (that I didn't manage to search well
enough in the first place), I thought it might be a good idea to show
the solution I eventually came to. The following will print the
current mode on the line below the prompt. The only flaw I know of is
that a long line that wraps at the edge of the terminal will overwrite
the mode indicator until either the next line or the next mode change.
If anyone can make any suggestions for improvements, I'd be happy to hear them.
Thanks for the help, all!
--------------------------
bindkey -v
function my-accept-line {
POSTDISPLAY=""
zle .accept-line
}
zle -N my-accept-line
bindkey "^M" my-accept-line
bindkey "^J" my-accept-line
setopt prompt_subst;
PS1=$'%{\e7\e[${COLUMNS}G \e[K-- INSERT --\e8\e[B\e[A%}'"$PS1"
PS2=$'%{\e7\e[${COLUMNS}G \e[K-- INSERT --\e8\e[B\e[A%}'"$PS2"
PS3=$'%{\e7\e[${COLUMNS}G \e[K-- INSERT --\e8\e[B\e[A%}'"$PS3"
PS4=$'%{\e7\e[${COLUMNS}G \e[K-- INSERT --\e8\e[B\e[A%}'"$PS4"
function zle-keymap-select {
if [[ "$KEYMAP" == vicmd ]]; then
POSTDISPLAY=$'\n'"-- NORMAL --"
else
POSTDISPLAY=$'\n'"-- INSERT --"
fi
}
zle -N zle-keymap-select
Messages sorted by:
Reverse Date,
Date,
Thread,
Author