zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: zsh-workers@zsh.org
Subject: Re: Fwd: In Vi mode, show whether "insert" or "command" state is active
Date: Wed, 17 Dec 2014 19:27:44 +0100	[thread overview]
Message-ID: <5708.1418840864@quattro> (raw)
In-Reply-To: <141217085549.ZM555@torch.brasslantern.com>

Bart wrote:
>
> } zle-keymap-select () {
> }     if [ $KEYMAP = vicmd ]; then
> }         echo -en "\e[5 q"
> }     else
> }         echo -en "\e[1 q"
> }     fi
> }     zle reset-prompt
> } }
> } zle -N zle-keymap-select
> 
> You don't even need the reset-prompt in that case because you're echo'ng
> a nonprinting sequence that causes the terminal to change the cursor
> shape.

However, you will need to ensure that the cursor is always reset when a
line is accepted. Most reliable place to do that appears to be POSTEDIT:
  POSTEDIT+=$'\e[2 q'

I find the cursor shape is actually much better than the prompt (or
right prompt) for indicating the mode. Only problem is that it can be
hard to find a narrow bar style cursor in a screenful of text.

I'd also recommend configuring either the zle highlighting of the region
or the cursor to use some colour. If you take the defaults of both zsh
and most terminal emulators, the cursor is a large inverse block and the
region is highlighted in inverse video. This makes it hard to tell where
the cursor is and whether the cursor position is included in the region
or not.

Oliver


  reply	other threads:[~2014-12-17 18:34 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-17  7:13 Jason Spiro
2014-12-17  7:58 ` Nathan Schwarz
2014-12-17 16:55   ` Bart Schaefer
2014-12-17 18:27     ` Oliver Kiddle [this message]
2014-12-17  8:23 ` Bart Schaefer
2014-12-22  0:07 Jason Spiro
2014-12-22  1:57 ` Bart Schaefer

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=5708.1418840864@quattro \
    --to=okiddle@yahoo.co.uk \
    --cc=zsh-workers@zsh.org \
    /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).