Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Completion behaviour in 4.1.0-dev-1
- X-seq: zsh-workers 15945
- From: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: Re: Completion behaviour in 4.1.0-dev-1
- Date: Fri, 5 Oct 2001 13:55:29 +0200
- In-reply-to: <OFC4EBD8EF.85BDCCC0-ON80256ADB.0058B494@xxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <OFC4EBD8EF.85BDCCC0-ON80256ADB.0058B494@xxxxxxxxxxxxxxx>
martin.ebourne@xxxxxxxxxxxx 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@xxxxxxxxxxxxxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author