From: Stephane Chazelas <Stephane_Chazelas@yahoo.fr>
To: Peter Stephenson <pws@csr.com>
Cc: Matthieu Louvel de Monceaux <glory69@gmail.com>, zsh-workers@sunsite.dk
Subject: Re: Weird Vi-mode behavior
Date: Mon, 3 Nov 2008 12:56:09 +0000 [thread overview]
Message-ID: <20081103125609.GA4855@sc.homeunix.net> (raw)
In-Reply-To: <200811031237.mA3Cb2VS013961@news01.csr.com>
On Mon, Nov 03, 2008 at 12:37:02PM +0000, Peter Stephenson wrote:
> Matthieu Louvel de Monceaux wrote:
> > When we return from command mode to insert mode, we can't modify
> > the text from the beginning to the spot where we got insert ...
> > Definitely a weird behavior ...
> >
> > To get it too, just type 'foo folk x' for example.
> > Then Esc, type 'b' to go to the previous word, then press 'i' to go
> > insert mode.
> > Now you can't edit the 'foo ' part anymore.
>
> I'm sorry, I don't understand.
[...]
I suspect he is refering to the traditional vi behavior of
vi-backward-delete-char documented in "info zsh 'Modifying
Text'"
vi-backward-delete-char (unbound) (X) (^H)
Delete the character behind the cursor, without changing lines.
If in insert mode, this won't delete past the point where insert
mode was last entered.
So I suspects he wants instead:
if (($+terminfo[kbs])); then
bindkey -M viins $terminfo[kbs] backward-delete-char
else
bindkey -M viins '^?' backward-delete-char
bindkey -M viins '^H' backward-delete-char
fi
(($+terminfo[kdch1])) &&
bindkey -M viins $terminfo[kdch1] delete-char
The above trys to map the emacs-style (as opposed to vi style)
backward-delete-char to the character sent by the backspace key
(using the terminfo database if it's there, or hardcoding both
^? and ^H). It also maps delete-char to the character sent by
the delete key if the terminfo database has that information.
Note that on a number of terminals, backspace sends ^H and
delete ^? while in a number of others backspace sends ^? and
delete something else like the sequence \e[3~
--
Stéphane
next prev parent reply other threads:[~2008-11-03 12:56 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-03 12:24 Matthieu Louvel de Monceaux
2008-11-03 12:37 ` Peter Stephenson
2008-11-03 12:56 ` Stephane Chazelas [this message]
2008-11-03 17:34 ` Matthieu Louvel de Monceaux
2008-11-03 17:38 ` Mikael Magnusson
2008-11-03 17:45 ` Matthieu Louvel de Monceaux
2008-11-03 17:50 ` Mikael Magnusson
2008-11-03 17:55 ` Matthieu Louvel de Monceaux
2008-11-03 23:09 ` Matt Wozniski
2008-11-04 0:50 ` Matthieu Louvel de Monceaux
2008-11-03 17:39 ` Peter Stephenson
2008-11-03 13:12 ` Matthieu Louvel de Monceaux
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=20081103125609.GA4855@sc.homeunix.net \
--to=stephane_chazelas@yahoo.fr \
--cc=glory69@gmail.com \
--cc=pws@csr.com \
--cc=zsh-workers@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).