From 5470c1fe38a47bd4eb1da9197786f8fdd4b2a952 Mon Sep 17 00:00:00 2001 From: Bart Schaefer Date: Thu, 21 Jun 2001 09:33:15 +0000 Subject: Completion for AUTO_CD. --- ChangeLog | 5 +++++ Completion/Zsh/Command/_cd | 2 +- Completion/Zsh/Context/_autocd | 5 +++++ Completion/Zsh/Type/_command_names | 2 +- 4 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 Completion/Zsh/Context/_autocd diff --git a/ChangeLog b/ChangeLog index 1a5c72691..4d9847062 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2001-06-21 Bart Schaefer + * 15020: Completion/Zsh/Command/_cd, Completion/Zsh/Context/_autocd, + Completion/Zsh/Type/_command_names: When AUTO_CD is set, complete + directory names (including along cdpath) as well as commands when + in command position. + * 15018: Completion/compinit: Fix exit status of compdef. 2001-06-20 Bart Schaefer diff --git a/Completion/Zsh/Command/_cd b/Completion/Zsh/Command/_cd index 2fd2af9be..71fa1a8ad 100644 --- a/Completion/Zsh/Command/_cd +++ b/Completion/Zsh/Command/_cd @@ -24,7 +24,7 @@ if [[ CURRENT -eq 3 ]]; then rep=(${${rep#${PWD%%$words[2]*}}%${PWD#*$words[2]}}) (( $#rep )) && _wanted -C replacement strings expl replacement compadd -a rep else - _directory_stack && ret=0 + [[ CURRENT -gt 1 ]] && _directory_stack && ret=0 if [[ $PREFIX != (\~|/|./|../)* && $#cdpath -ne 0 ]]; then local tdir tdir2 diff --git a/Completion/Zsh/Context/_autocd b/Completion/Zsh/Context/_autocd new file mode 100644 index 000000000..58ba5b17b --- /dev/null +++ b/Completion/Zsh/Context/_autocd @@ -0,0 +1,5 @@ +#compdef -command- + +_command_names +local ret=$? +[[ -o autocd ]] && _cd || return ret diff --git a/Completion/Zsh/Type/_command_names b/Completion/Zsh/Type/_command_names index cf4088295..006006348 100644 --- a/Completion/Zsh/Type/_command_names +++ b/Completion/Zsh/Type/_command_names @@ -1,4 +1,4 @@ -#compdef -command- +#autoload # The option `-e' if given as the first argument says that we should # complete only external commands and executable files. This and a -- cgit 1.4.1