* [PATCH] bash-style completion
@ 1999-02-03 21:20 Dag-Erling Smorgrav
0 siblings, 0 replies; 3+ messages in thread
From: Dag-Erling Smorgrav @ 1999-02-03 21:20 UTC (permalink / raw)
To: zsh-workers
[-- 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);
+ }
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] bash-style completion
1999-02-04 8:15 Sven Wischnowsky
@ 1999-02-04 11:09 ` Dag-Erling Smorgrav
0 siblings, 0 replies; 3+ messages in thread
From: Dag-Erling Smorgrav @ 1999-02-04 11:09 UTC (permalink / raw)
To: Sven Wischnowsky; +Cc: zsh-workers, Dag-Erling Smorgrav
Sven Wischnowsky <wischnow@informatik.hu-berlin.de> writes:
> Dag-Erling Smorgrav wrote:
> > [...] I hacked zsh to provide
> > bash-style completion (TAB completes the unambiguous prefix, TAB again
> > lists possible completions). [...]
> I don't have a 3.0.5, so I couldn't try the patch. But as far as I can
> see, this should behave like normal completion with `setopt AUTOLIST'
> and `setopt LISTAMBIGUOUS'.
Sounds like another case of not enough RTFM ;)
Thanks,
DES
--
Dag-Erling Smorgrav - des@flood.ping.uio.no
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] bash-style completion
@ 1999-02-04 8:15 Sven Wischnowsky
1999-02-04 11:09 ` Dag-Erling Smorgrav
0 siblings, 1 reply; 3+ messages in thread
From: Sven Wischnowsky @ 1999-02-04 8:15 UTC (permalink / raw)
To: zsh-workers; +Cc: Dag-Erling Smorgrav
Dag-Erling Smorgrav wrote:
> 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.
I don't have a 3.0.5, so I couldn't try the patch. But as far as I can
see, this should behave like normal completion with `setopt AUTOLIST'
and `setopt LISTAMBIGUOUS'.
> The patches also fix a minor bug (lastambig was not being reset when
> the completion list is invalidated).
This is already in all current versions of 3.1.5.
(For Dag: the most recent version is available at
`http://www.ifh.de/~pws/computing/zsh-3.1.5-pws-6.tar.gz', but it's
*very* beta.)
Bye
Sven
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~1999-02-04 11:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-02-03 21:20 [PATCH] bash-style completion Dag-Erling Smorgrav
1999-02-04 8:15 Sven Wischnowsky
1999-02-04 11:09 ` Dag-Erling Smorgrav
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).