Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: vim-a-like vi mode status bar
- X-seq: zsh-users 4681
- From: Ian Lynagh <igloo@xxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: vim-a-like vi mode status bar
- Date: Sat, 16 Feb 2002 20:05:00 +0000
- In-reply-to: <20020216174804.GA11720@xxxxxxxxxxxxxxxxx>
- Mail-followup-to: zsh-users@xxxxxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20020216172000.GA892@xxxxxxxxxxxxxxxxxxxxx> <20020216174804.GA11720@xxxxxxxxxxxxxxxxx>
- Sender: Ian Lynagh <ian@xxxxxxxxxxxxxxxxxx>
Hi,
On Sat, Feb 16, 2002 at 06:48:05PM +0100, Thomas Köhler wrote:
>
> Ian Lynagh wrote [020216 18:28]:
> > I have thought it would be nice to have a vim-a-like indicator of
> > whether or not you are insert or command mode when using the vi line
> > editting mode for a long time now. In a burst of enthusiasm I have put
> > something together over the last couple of days (attached). However it's
> > not quite as nice as it might have been and I have run into a few
> > annoyances along the way.
>
> Well, I use something similar. Of course, I have a multiline
Thanks, very interesting to see another implementation.
> prompt, so what I have here might work for you, but it might need
> some adjustment - the escape sequences for moving the cursor
> might not work for your type of terminal...
That's an approach I thought of but decided against, partly because of
the potential terminal issues and partly because of the cases like
multi-line input and screen clearing. However, you seem to have these
mostly[0] sussed so I might switch to this with a simple command to
switch to a simpler prompt if I do happen to be using a less fancy
terminal.
[0] It still looks like it has problems when the prompt has scrolled off
the top of the screen, at least in an rxvt.
This should also solve a few of my current problems (flicker, characters
not being echoed when pasted and having the default state shown).
I do have a couple of further questions for you though...
> redisplay() {
> builtin zle .redisplay
> ( true ; show_mode "INSERT") &!
> }
I am not sure why you have the &! here - if it is worth doing then that
implies you might do something else before it has finished in which case
your cursor might not be where you think it is?
It also seems to me you might be better off with a variable (or zstyle
lookup or whatever) for the current state and a single redisplay. This
would have the advantage that you wouldn't have to worry about things
being rebound incorrectly later on.
> zle -N redisplay
Just overwriting the built-in widgets rather than aliasing seems so
*obvious* now how did I ever not think of it? Too caught up in the
excitement of being able to alias them I think!
> show_mode() {
> local COL
> local x
> COL=$[COLUMNS-3]
> COL=$[COL-$#1]
> x=$(echo $PREBUFFER | wc -l )
> x=$[x+1]
> echo -n "7[$x;A[0;G"
> echo -n ""
> echo -n "[0;37;44m--$1--[0m"
> echo -n "8"
> }
Am I missing something or is COL never actually used?
And doesn't
echo -n ""
do nothing?
Thanks
Ian
Messages sorted by:
Reverse Date,
Date,
Thread,
Author