From: Peter Stephenson <pws@csr.com>
To: zsh-users@sunsite.dk
Subject: Re: is there way to use vicmd (not viins) layout initially?
Date: Thu, 03 Apr 2003 14:20:42 +0100 [thread overview]
Message-ID: <4898.1049376042@csr.com> (raw)
In-Reply-To: "Ilya Kuznecov"'s message of "Thu, 03 Apr 2003 17:00:59 +0500." <20030403120059.GA5325@r3_kuznecov.lan.blok-caf.ru>
Ilya Kuznecov wrote:
> As far as I know, this is only viins mode by default. Do I fail?
You probably *should* be able to do this:
zle -A vicmd main
Unfortunately, if you do that, although the shell starts in vicmd mode,
you can't get into viins mode, because the code which implements
`vi-insert' switches to the main keymap, i.e. in this case straight back
to vicmd. This is actually documented, but I'm not sure if it's
necessary.
You can get round it with:
vi-insert() { zle -K viins; }
zle -N vi-insert
but unfortunately you need to rewrite every widget that switches to
insert mode (those bound to I, a, A, c, etc. etc.) in a similar fashion.
What does everyone think about tying vi-insert to switching to viins,
rather than `main' (and other logically related changes)? This would
need changes in the documentation, too.
Note there's nothing to stop you copying another keymap onto viins, so I
don't think this stops you doing anything you might want to.
I think the problem comes with the vi-cmd-mode binding in Emacs mode.
In this case, `i' or whatever will put you into vi insert mode, not back
to Emacs mode. But that seems to me to be exactly what is documented:
vi-insert (unbound) (i) (unbound)
Enter insert mode.
--- nothing about returning to the main keymap.
You can write a widget to switch the keymap.
main-map() { zle -K main; }
zle -N main-map
bindkey -M vicmd 'M' main-map
then i etc. still do what are documented, but 'M' returns you to the
main keymap.
This seems to me more useful and predictable than the current
arrangement.
If there's deathly silence I won't dare change this.
Index: Src/Zle/zle_vi.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_vi.c,v
retrieving revision 1.1.1.9
diff -u -r1.1.1.9 zle_vi.c
--- Src/Zle/zle_vi.c 3 Jul 1999 13:18:04 -0000 1.1.1.9
+++ Src/Zle/zle_vi.c 3 Apr 2003 12:57:32 -0000
@@ -89,7 +89,7 @@
startvitext(int im)
{
startvichange(im);
- selectkeymap("main", 1);
+ selectkeymap("viins", 1);
undoing = 0;
viinsbegin = cs;
}
@@ -98,7 +98,7 @@
int
vigetkey(void)
{
- Keymap mn = openkeymap("main");
+ Keymap mn = openkeymap("viins");
char m[3], *str;
Thingy cmd;
@@ -351,7 +351,7 @@
if ((c2 = getvirange(1)) != -1) {
ret = 0;
forekill(c2 - cs, 0);
- selectkeymap("main", 1);
+ selectkeymap("viins", 1);
viinsbegin = cs;
undoing = 0;
}
**********************************************************************
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential
and/or privileged material.
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by
persons or entities other than the intended recipient is
prohibited.
If you received this in error, please contact the sender and
delete the material from any computer.
**********************************************************************
next prev parent reply other threads:[~2003-04-03 13:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-04-03 12:00 Ilya Kuznecov
2003-04-03 13:20 ` Peter Stephenson [this message]
2003-04-03 14:49 ` Zefram
2003-04-03 15:30 ` Peter Stephenson
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=4898.1049376042@csr.com \
--to=pws@csr.com \
--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).