Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: simpler completion
On Tue, Jun 24, 2025 at 6:58 PM Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:
>
> On 2025-06-24 09:48, Bart Schaefer wrote:
> > If I remove the space and hit TAB directly after "mnt" then I see
> > those two offered,
> How, since you don't have the files?
By "those two" I meant
Completing executable file
Completing shell function
I don't need files there to see those messages. Those are standard
things to complete when in "command position" -- in fact I'm puzzled
why you want to complete local files at that place on the command
line?
> But I do get completion of commands too, and I want that to stop. If I
> type 'gim' then press TAB, it completes to 'gimp' with no messages and
> of course gimp is an application. Files only please. No messages.
The messages are coming from
zstyle ':completion:*' format 'Completing %d'
Anyway, if you type ctl-x h at the command prompt you'll see something
like this (pardon likely misplaced line wrapping):
tags in context :completion::complete:-command-::
commands builtins functions suffix-aliases reserved-words jobs
parameters parameters aliases (_command_names _autocd)
commands
(_path_commands _path_commands
_command_names _autocd)
jobs
(_jobs _command_names _autocd)
tags in context :completion::files:::
globbed-files (_files)
Notice that the default thing to do in command position (the -command-
context) is to complete everything OTHER THAN files. Cases where you
want a file as the very first word on the command line are presumed to
be almost nonexistent. To get what you're asking for, you have to
tell completion to skip over that context entirely. Which you can do
with:
zstyle ':completion::-command-::' tag-order -
It nevertheless seems an unlikely thing to want. What are you going
to do with that file name after you've completed it?
Messages sorted by:
Reverse Date,
Date,
Thread,
Author