* Completion in pwd before subdirecories
@ 2003-12-13 15:46 Jesper Holmberg
2003-12-13 19:19 ` Bart Schaefer
0 siblings, 1 reply; 7+ messages in thread
From: Jesper Holmberg @ 2003-12-13 15:46 UTC (permalink / raw)
To: Zsh-users List
I use menu-complete. I don't know if zsh has changed its default behavior
in recent versions, or if I only now noticed something I haven't noticed
before.
In any case, suppose I have these files in a directory:
dota1.pdf dota2.pdf dir
where dir is a directory.
If I now type xpdf d<tab>, zsh will suggest dir as the first completion. I
would prefer it if it tried it with any file matching in the current
directory, before going into the sub directories. I would thus rather see
dota1.pdf and dota2.pdf suggested before dir, in my example.
Is this possible?
Jesper
This is zsh 4.1.1 under Debian.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Completion in pwd before subdirecories
2003-12-13 15:46 Completion in pwd before subdirecories Jesper Holmberg
@ 2003-12-13 19:19 ` Bart Schaefer
2003-12-13 23:39 ` Jesper Holmberg
0 siblings, 1 reply; 7+ messages in thread
From: Bart Schaefer @ 2003-12-13 19:19 UTC (permalink / raw)
To: Zsh-users List
On Dec 13, 4:46pm, Jesper Holmberg wrote:
}
} In any case, suppose I have these files in a directory:
}
} dota1.pdf dota2.pdf dir
}
} where dir is a directory.
}
} If I now type xpdf d<tab>, zsh will suggest dir as the first completion.
Are you sure this isn't happening just because zsh presents the menu in
alphabetical order?
} I would prefer it if it tried it with any file matching in the current
} directory, before going into the sub directories. I would thus rather see
} dota1.pdf and dota2.pdf suggested before dir, in my example.
}
} Is this possible?
It depends on wheher you're using compsys or compctl. Does your .zshrc
(or the /etc/z* files, I'm not familiar with Debian) contain
autoload -U compinit
compinit
?? If not, you have almost no control over the sorting order.
If you are using compsys, then the group-order style is probably what
you want:
zstyle ':completion:*' group-name ''
zstyle ':completion:*' group-order files directories
Read "man zshcompsys" for descriptions of group-name and group-order.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Completion in pwd before subdirecories
2003-12-13 19:19 ` Bart Schaefer
@ 2003-12-13 23:39 ` Jesper Holmberg
2003-12-15 11:49 ` Oliver Kiddle
0 siblings, 1 reply; 7+ messages in thread
From: Jesper Holmberg @ 2003-12-13 23:39 UTC (permalink / raw)
To: Zsh-users List
* On Sat Dec 13, Bart Schaefer wrote:
> On Dec 13, 4:46pm, Jesper Holmberg wrote:
> } If I now type xpdf d<tab>, zsh will suggest dir as the first completion.
>
> Are you sure this isn't happening just because zsh presents the menu in
> alphabetical order?
Yes you're right, it's the alphabetical order.
> } I would prefer it if it tried it with any file matching in the current
> } directory, before going into the sub directories. I would thus rather see
> } dota1.pdf and dota2.pdf suggested before dir, in my example.
> }
> } Is this possible?
>
> It depends on wheher you're using compsys or compctl. Does your .zshrc
> (or the /etc/z* files, I'm not familiar with Debian) contain
>
> autoload -U compinit
> compinit
>
> ?? If not, you have almost no control over the sorting order.
I use compsys, with the above-mentioned lines in my .zshrc
> If you are using compsys, then the group-order style is probably what
> you want:
>
> zstyle ':completion:*' group-name ''
> zstyle ':completion:*' group-order files directories
I tried this, and I think I understand what it does, but it doesn't make
any difference. If I have this:
dar dir dor
where dir is a directory, typing cat <tab> still gives me dar dir dor in
that order.
Jesper
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Completion in pwd before subdirecories
2003-12-13 23:39 ` Jesper Holmberg
@ 2003-12-15 11:49 ` Oliver Kiddle
2003-12-15 12:51 ` Jesper Holmberg
2003-12-15 16:09 ` Bart Schaefer
0 siblings, 2 replies; 7+ messages in thread
From: Oliver Kiddle @ 2003-12-15 11:49 UTC (permalink / raw)
To: Zsh-users List
Jesper Holmberg wrote:
> > zstyle ':completion:*' group-name ''
> > zstyle ':completion:*' group-order files directories
>
> I tried this, and I think I understand what it does, but it doesn't make
> any difference. If I have this:
Files are completed with the all-files and globbed-files tags so no, it
doesn't work.
You need something like:
zstyle ':completion:*' file-patterns \
'*(-/):directories %p(^-/):globbed-files' '*:all-files'
zstyle ':completion:*' group-name ''
zstyle ':completion:*' group-order \
globbed-files all-files directories
Unfortunately, that will now break for any completion which specifies a
glob qualifier such as _chown. I've been meaning to go through adding
`#q' into all of them to allow this.
I'm not quite sure whether the default file-patterns style shouldn't
use %p(^-/) for globbed-files anyway. What if we want to glob directory
names from a completion function? Comments on this should probably go
to -workers.
Oliver
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Completion in pwd before subdirecories
2003-12-15 11:49 ` Oliver Kiddle
@ 2003-12-15 12:51 ` Jesper Holmberg
2003-12-15 18:48 ` Bart Schaefer
2003-12-15 16:09 ` Bart Schaefer
1 sibling, 1 reply; 7+ messages in thread
From: Jesper Holmberg @ 2003-12-15 12:51 UTC (permalink / raw)
To: Zsh-users List
* On Mon Dec 15, Oliver Kiddle wrote:
> You need something like:
>
> zstyle ':completion:*' file-patterns \
> '*(-/):directories %p(^-/):globbed-files' '*:all-files'
> zstyle ':completion:*' group-name ''
> zstyle ':completion:*' group-order \
> globbed-files all-files directories
>
> Unfortunately, that will now break for any completion which specifies a
> glob qualifier such as _chown. I've been meaning to go through adding
> `#q' into all of them to allow this.
I put your lines in my .zshrc, but now I get surprising results:
% ls -R
.:
dar dir dor
./dir:
dur
i.e. dir is a directory including a file called dur.
Now "cat d<tab>" gives dir/, yet another <tab> gives dir/dur, and then it
stays dir/dur no matter how many times I hit <tab>.
Jesper
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Completion in pwd before subdirecories
2003-12-15 12:51 ` Jesper Holmberg
@ 2003-12-15 18:48 ` Bart Schaefer
0 siblings, 0 replies; 7+ messages in thread
From: Bart Schaefer @ 2003-12-15 18:48 UTC (permalink / raw)
To: Zsh-users List
On Dec 15, 1:51pm, Jesper Holmberg wrote:
} Subject: Re: Completion in pwd before subdirecories
}
} > zstyle ':completion:*' file-patterns \
} > '*(-/):directories %p(^-/):globbed-files' '*:all-files'
} > zstyle ':completion:*' group-name ''
} > zstyle ':completion:*' group-order \
} > globbed-files all-files directories
} >
} I put your lines in my .zshrc, but now I get surprising results:
There's yet another bug wherein %p is not expanded correctly in the
file-patterns style, which may be affecting you. That was fixed in
zsh-workers/18811, I believe.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Completion in pwd before subdirecories
2003-12-15 11:49 ` Oliver Kiddle
2003-12-15 12:51 ` Jesper Holmberg
@ 2003-12-15 16:09 ` Bart Schaefer
1 sibling, 0 replies; 7+ messages in thread
From: Bart Schaefer @ 2003-12-15 16:09 UTC (permalink / raw)
To: Zsh-users List
On Dec 15, 12:49pm, Oliver Kiddle wrote:
}
} > > zstyle ':completion:*' group-name ''
} > > zstyle ':completion:*' group-order files directories
} >
} > I tried this, and I think I understand what it does, but it doesn't make
} > any difference.
}
} Files are completed with the all-files and globbed-files tags so no, it
} doesn't work.
Oops. That's what I get for cut'n'pasting from my cvs completion style;
the cvs completer does have "files" and "directories" by default.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2003-12-15 18:49 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-13 15:46 Completion in pwd before subdirecories Jesper Holmberg
2003-12-13 19:19 ` Bart Schaefer
2003-12-13 23:39 ` Jesper Holmberg
2003-12-15 11:49 ` Oliver Kiddle
2003-12-15 12:51 ` Jesper Holmberg
2003-12-15 18:48 ` Bart Schaefer
2003-12-15 16:09 ` Bart Schaefer
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).