From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: dana <dana@dana.is>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: [PATCH] Improve _man file-path completion
Date: Sat, 4 Jan 2020 00:39:13 +0000 [thread overview]
Message-ID: <20200104003913.3gq5hnlmhndwbzz4@tarpaulin.shahaf.local2> (raw)
In-Reply-To: <83C0ABA0-99A5-4DAD-98D6-DBB919F61E24@dana.is>
dana wrote on Fri, Jan 03, 2020 at 18:12:28 -0600:
> This has been annoying me for a little while. Since we glob for man pages with
> _path_files, it's not possible to navigate through sub-directories when
> completing file paths. Just using _files fixes that, but then when you have
> separate-sections on you get like:
>
> % man /usr/local/l<TAB>
> completing manual page, section 1:
> lib/ libexec/ local/
> completing manual page, section 2:
> lib/ libexec/ local/
> completing manual page, section 3:
> lib/ libexec/ local/
> ...
>
> Separating by-path pages into sections is nice, but the only way i can think
> of to make it work well with directory navigation is to do the globbing
> 'manually' first and decide what to insert based on that, and that's a bigger
> job. (But let me know if you have any better ideas)
How about this (relative to master)? It fixes your original problem but
retains the separate-sections behaviour for man pages specified by filename.
diff --git a/Completion/Unix/Command/_man b/Completion/Unix/Command/_man
index 41ae85a1f..bee7be410 100644
--- a/Completion/Unix/Command/_man
+++ b/Completion/Unix/Command/_man
@@ -381,8 +381,9 @@ _man() {
(( $#sects )) || return 1
- _tags manuals.${^sects}
+ _tags files manuals.${^sects}
while _tags; do
+ _requested files expl "subdirectories" _files -/ && ret=0
for sect_dirname in $sects; do
d=$sect_dirname
(( $+sect_descs[$d] )) && d+=" (${sect_descs[$d]})"
Aside:
% compdef _f f
% _f() _files -/
% f Util/<TAB>
.
offers files, rather than nothing. Bug?
next prev parent reply other threads:[~2020-01-04 0:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-04 0:12 dana
2020-01-04 0:39 ` Daniel Shahaf [this message]
2020-01-04 1:17 ` dana
2020-01-04 1:46 ` Bart Schaefer
2020-01-04 12:46 ` Daniel Shahaf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200104003913.3gq5hnlmhndwbzz4@tarpaulin.shahaf.local2 \
--to=d.s@daniel.shahaf.name \
--cc=dana@dana.is \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).