Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
autoload path completion with expansions
- X-seq: zsh-workers 49376
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: autoload path completion with expansions
- Date: Sun, 5 Sep 2021 11:54:37 -0700
- Archived-at: <https://zsh.org/workers/49376>
- List-id: <zsh-workers.zsh.org>
Starting from zsh -f + compinit + zstyle '*' format %d (so, no completer style)
% autoload $PWD/<TAB>
`vars' or `shell function'
This surprised me, because
% ls $PWD/<TAB>
file
(list of files in the current directory)
Turns out this is because _typeset (which handles autoload) only calls
_files when the word on the command line already begins with "/" or
"~".
I debated also adding \` to the pattern. Thoughts?
diff --git a/Completion/Zsh/Command/_typeset b/Completion/Zsh/Command/_typeset
index d3304bed0..26eab0b21 100644
--- a/Completion/Zsh/Command/_typeset
+++ b/Completion/Zsh/Command/_typeset
@@ -101,9 +101,9 @@ if [[ "$state" = vars_eq ]]; then
elif (( $+opt_args[-w] )); then
_wanted files expl 'zwc file' _files -g '*.zwc(-.)' && ret=0
elif [[ $service = autoload || -n $opt_args[(i)-[uU]] ]]; then
- if [[ $PREFIX[1] = [/~] ]]; then
+ if [[ $PREFIX[1] = [$/~] ]] && _files; then
# Autoload by absolute path
- _files && ret=0
+ ret=0
else
args=(${^fpath}/*(-.:t))
# Filter out functions already loaded or marked for autoload.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author