Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Fwd: In Vi mode, show whether "insert" or "command" state is active
- X-seq: zsh-workers 33997
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: Fwd: In Vi mode, show whether "insert" or "command" state is active
- Date: Wed, 17 Dec 2014 19:27:44 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1418840866; bh=immCPYX1B5abBfwxud/OUWs4mA1LgbaBjQjPbwv54lg=; h=In-reply-to:From:References:To:Subject:Date:From:Subject; b=g4N2U+1yyefdbgHMVJcO+1qr2T/i3F8YYJgdfO0zFaFjkGf/CIy1wPlgkwKe413ktUqIyJK0o39fjldUP1oQhxIJc1aa5cPq8MnjFvUvVg+4IFF055H2Ykj0WCSQpY7pR0oNlt3gPpj1SsOiQvIMQOcjAnFAbLt+k/nNy0hL+oXEj3VGEW+wSQJRf4vnBzqiIeOnJ2oOosLP+KuWdaB5Tgkej8OkXjTJlb0mFeFQVOHhGJ269Rc/SFsoPjLmROq7ejKiGvTlT64fHsKoiUGBQhiMmf3n0rEpaVZTGzVLm2OzBwq6SXVtTRX5XnqbpNUeeC1+jTPlg4/yqy3dA6uRmg==
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s2048; d=yahoo.co.uk; b=ctwwk/xzJgu8+/kGj7oyk7870ith4wnH1Kop1ZRzxzrKd1XSRRuRN5BN/BkN0nVUnNOAAipvjigR6606E21EgDEpyRYQgOp5v26IhZ+3Ucin87j6fQsWK1zwsbKtcnUrzSs6LP/rYVJT5xUUbiWUh9JJPMjQg3wdckF5tSrBApdAO7JhAylo12otk/SYzX6IoHTvCEf8iVerUchgx84/yiwfV0pUwvv1wgSHiq0a9JN85LTpEJdJjzfgkFVQgqCrCugNHw3Ek4c7GTq9ueI1BGMIxb4Hs1UtMxwOeuQRadL3JKn/DYJKJZ7eIozSIhA2sO/BpzYXjlh8oQo/p70cxQ==;
- In-reply-to: <141217085549.ZM555@torch.brasslantern.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <CAN2X26=YUSe95T0aMHxTCccXAE7ZeZPBN2aR=4L_tssVxxJLSQ@mail.gmail.com> <20141217075818.GA5675@Persephone> <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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author