From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.dk
Subject: Re: Completion behaviour in 4.1.0-dev-1
Date: Fri, 5 Oct 2001 13:55:29 +0200 [thread overview]
Message-ID: <15293.40881.289353.876742@gargle.gargle.HOWL> (raw)
In-Reply-To: <OFC4EBD8EF.85BDCCC0-ON80256ADB.0058B494@uk.jpmorgan.com>
martin.ebourne@arcordia.com wrote:
> I've just upgraded from Zsh 4.0.2 to 4.1.0-dev-1, and I've noticed a change
> in completion behaviour.
>
> If I do:
>
> % zsh -f
> gdd-odybin2% autoload -U compinit
> gdd-odybin2% compinit -C
> gdd-odybin2% setopt cdablevars
> gdd-odybin2% zstyle ':completion:*:complete:cd:*' tag-order local-directories
> gdd-odybin2% cd c<TAB>
>
> I get a list of local directories, users, and anything else cd can make use
> of. If I do this on 4.0.2 then I only get local directories, assuming one
> matches - otherwise I get the other stuff - which is what I want.
>
> In 4.1.0 I get only the local directories if I do 'cd <TAB>', just like in
> 4.0.2. It's only when I've added the 'c' that it gives the full list.
Yes, we had some trouble with _cd. The patch below hopefully makes
this better configurable, using the named-directories tag for anything
completed by _tilde.
Bye
Sven
Index: Completion/Zsh/Command/_cd
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Zsh/Command/_cd,v
retrieving revision 1.4
diff -u -r1.4 _cd
--- Completion/Zsh/Command/_cd 2001/08/22 15:37:19 1.4
+++ Completion/Zsh/Command/_cd 2001/10/05 11:54:17
@@ -32,13 +32,17 @@
fi
if [[ $PREFIX != (\~|/|./|../)* ]]; then
- local tmpcdpath
+ local tmpcdpath alt
+
tmpcdpath=(${${(@)cdpath:#.}:#$PWD})
+ (( $#tmpcdpath )) &&
+ alt=( 'path-directories:directory in cdpath:_path_files -W tmpcdpath -/' )
+
# With cdablevars, we can complete foo as if ~foo/
if [[ -o cdablevars && -n "$PREFIX" && "$PREFIX" != <-> ]]; then
if [[ "$PREFIX" != */* ]]; then
- _tilde && ret=0
+ alt=( "$alt[@]" 'named-directories: : _tilde' )
else
local oipre="$IPREFIX" opre="$PREFIX" dirpre dir
@@ -51,26 +55,22 @@
PREFIX="${PREFIX#*/}"
[[ $#dir -eq 1 && "$dir[1]" != "~$dirpre" ]] &&
- _wanted named-directories expl 'directories after cdablevar' \
+ _wanted named-directories expl 'directory after cdablevar' \
_path_files -W dir -/ && ret=0
PREFIX="$opre"
IPREFIX="$oipre"
fi
- fi
- if [[ $#tmpcdpath -ne 0 ]]; then
- # Don't complete local directories in command position, that's
- # already handled by _command_names (see _autocd)
- if [[ CURRENT -eq 1 ]]; then
- _wanted path-directories expl 'directories in cdpath' \
- _path_files -W tmpcdpath -/ && ret=0
- else
- _alternative \
- 'local-directories:local directories:_path_files -/' \
- "path-directories:directories in cdpath:_path_files -W tmpcdpath -/" && ret=0
- fi
- return ret
fi
+ # Don't complete local directories in command position, that's
+ # already handled by _command_names (see _autocd)
+
+ [[ CURRENT -ne 1 ]] &&
+ alt=( "${cdpath+local-}directories:${cdpath+local }directory:_path_files -/" "$alt[@]" )
+
+ _alternative "$alt[@]" && ret=0
+
+ return ret
fi
_wanted directories expl directory _path_files -/ && ret=0
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
prev parent reply other threads:[~2001-10-05 11:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-10-04 16:41 martin.ebourne
2001-10-05 11:55 ` Sven Wischnowsky [this message]
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=15293.40881.289353.876742@gargle.gargle.HOWL \
--to=wischnow@informatik.hu-berlin.de \
--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).