Zsh Mailing List Archive
Messages sorted by:
Re: two completion questions
- X-seq: zsh-users 2766
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxxxxxxxxx>
- To: Andy Spiegl <zsh.Andy@xxxxxxxxx>, zsh-users@xxxxxxxxxxxxxx
- Subject: Re: two completion questions
- Date: Fri, 10 Dec 1999 18:33:37 +0000
- In-reply-to: <19991210184036.A29989@xxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxxxxxx; run by ezmlm
- References: <19991210184036.A29989@xxxxxxxxxxxx>
On Dec 10, 6:40pm, Andy Spiegl wrote:
} Subject: two completion questions
} Now: (cursor position at "_")
} hamster:/tmp/zsh>cat a_<TAB>
} leads to
} hamster:/tmp/zsh>cat a _
} However I would expect zsh to do this:
} hamster:/tmp/zsh>cat a_
} a ab abc
} Maybe there is a switch I missed?
It would appear that you have "setopt REC_EXACT". With that set, zsh
accepts immediately any prefix that exactly matches an existing file,
even if there are longer names that also match.
} The other problem is that zsh doesn't append a / after .. although it's a
} directory. Here's an example again:
} hamster:/tmp/zsh>cd .._<TAB>
} This just beeps instead of leading to this:
} hamster:/tmp/zsh>cd ../_
I'm not precisely sure why zsh handles ".." that way. You can fix this
with compctl completion as follows:
compctl -D -f + -g .. -S / -q
If you're using the new function-based completion in 3.1.6, it's going to
require some editing of the _path_files completer. Hey, Sven, do you (or
any other zsh-workers) remember the rationale for this handling of ".."?
} Actually this just reminded me of a third annoyance. :-)
} zsh removes a (previously completed) / or a space in the middle of the
} input line after C-e or C-a.
That's because you're using expand-or-complete-prefix. (Which you must
be, or else this ...
} hamster:/tmp>echo zs_ab (...press TAB...)
} hamster:/tmp>echo zsh/_ab (...now Ctrl-E to go to the end of line...)
... would not happen at all; you'd just get a feep.)
With expand-or-complete-prefix, the stuff to the right of the cursor is
not considered to be part of the result of the completion, so as far as
zsh can tell when you follow the completion with a cursor motion rather
than an character insertion it means you didn't want the slash.
} Off course "unsetopt AUTO_REMOVE_SLASH" removes this behavior, but
} then the slash is never removed. I would expect zsh to remove the
} slash/space only if there is no character below (or to the right of)
} the cursor. Am I wrong?
Autoremoval is not based on what's on the line, it's based on what the
next action is. Essentially, insertions cause it to remain (unless the
inserted character is the same as the suffix) and anything else causes
it to be removed.
Bart Schaefer Brass Lantern Enterprises
Messages sorted by: