zsh-users
 help / color / mirror / code / Atom feed
From: Ian Lynagh <igloo@earth.li>
To: zsh-users@sunsite.dk
Subject: Re: vim-a-like vi mode status bar
Date: Sat, 16 Feb 2002 20:05:00 +0000	[thread overview]
Message-ID: <20020216200500.GA1720@stu163.keble.ox.ac.uk> (raw)
In-Reply-To: <20020216174804.GA11720@picard.franken.de>


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


  reply	other threads:[~2002-02-16 20:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-16 17:20 Ian Lynagh
2002-02-16 17:48 ` Thomas Köhler
2002-02-16 20:05   ` Ian Lynagh [this message]
2002-02-17 18:57     ` Thomas Köhler
2002-02-20 22:12 ` Steve Talley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020216200500.GA1720@stu163.keble.ox.ac.uk \
    --to=igloo@earth.li \
    --cc=zsh-users@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).