From: Dag-Erling Smorgrav <des@flood.ping.uio.no>
To: zsh-workers@sunsite.auc.dk
Subject: [PATCH] bash-style completion
Date: 03 Feb 1999 22:20:46 +0100 [thread overview]
Message-ID: <86n22vfakx.fsf@niobe.ewox.org> (raw)
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2427 bytes --]
Hi,
I installed zsh 3.0.5 today and immediately liked it a lot better than
bash2, which I'd previously been using. The only zsh feature I dislike
is the csh-style completion (TAB to complete the unambiguous prefix,
^D to list possible completions), so I hacked zsh to provide
bash-style completion (TAB completes the unambiguous prefix, TAB again
lists possible completions). Patches against 3.0.5 are attached. Hope
they can be of use.
The patches also fix a minor bug (lastambig was not being reset when
the completion list is invalidated).
To use bash-style completion, just bind your favorite key to
'complete-or-list'. I use 'bindkey \\t complete-or-list'.
OBTW, I put completeorlist() at the end of zle_tricky.c because it
uses lastambig. There's probably a cleaner way, e.g. defining
COMP_COMPLETE_OR_LIST and doing the dirty work (all four lines of it)
within do_complete().
Oh, and I'm not on the list, so please Cc: me any questions or
comments.
DES
--
Dag-Erling Smørgrav - des@flood.ping.uio.no
--- zle.h.orig Tue Jun 3 07:11:24 1997
+++ zle.h Wed Feb 3 18:48:03 1999
@@ -291,6 +291,7 @@
z_beginningoflinehist,
z_capitalizeword,
z_clearscreen,
+ z_completeorlist,
z_completeword,
z_copyprevword,
z_copyregionaskill,
--- zle_bindings.c.orig Fri Jun 28 15:43:51 1996
+++ zle_bindings.c Wed Feb 3 18:46:08 1999
@@ -51,6 +51,7 @@
{"beginning-of-line-hist", beginningoflinehist, ZLE_MOVEMENT},
{"capitalize-word", capitalizeword, 0},
{"clear-screen", clearscreen, ZLE_MENUCMP},
+ {"complete-or-list", completeorlist, ZLE_MENUCMP},
{"complete-word", completeword, ZLE_MENUCMP},
{"copy-prev-word", copyprevword, 0},
{"copy-region-as-kill", copyregionaskill, ZLE_KILL},
--- zle_tricky.c.orig Wed Feb 3 18:49:08 1999
+++ zle_tricky.c Wed Feb 3 22:09:29 1999
@@ -2998,7 +2998,7 @@
if (ccmain != &cc_dummy)
freecompctl(ccmain);
}
- menucmp = showinglist = validlist = 0;
+ menucmp = showinglist = validlist = lastambig = 0;
menucur = NULL;
}
@@ -3968,4 +3968,20 @@
deletechar(); /* delete the added space. */
}
remove_at = -1;
+}
+
+/**/
+void
+completeorlist(void)
+{
+ usemenu = isset(MENUCOMPLETE);
+ useglob = isset(GLOBCOMPLETE);
+ if (c == '\t' && usetab())
+ selfinsert();
+ else {
+ if (lastambig)
+ docomplete(COMP_LIST_COMPLETE);
+ else
+ docomplete(COMP_COMPLETE);
+ }
}
next reply other threads:[~1999-02-03 21:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-02-03 21:20 Dag-Erling Smorgrav [this message]
1999-02-04 8:15 Sven Wischnowsky
1999-02-04 11:09 ` Dag-Erling Smorgrav
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=86n22vfakx.fsf@niobe.ewox.org \
--to=des@flood.ping.uio.no \
--cc=zsh-workers@sunsite.auc.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).