From: dana <dana@dana.is>
To: Daniel Shahaf <d.s@daniel.shahaf.name>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: [PATCH] Improve _man file-path completion
Date: Fri, 3 Jan 2020 19:17:56 -0600 [thread overview]
Message-ID: <07B00625-9EC2-454E-B3E0-6F520DE4A899@dana.is> (raw)
In-Reply-To: <20200104003913.3gq5hnlmhndwbzz4@tarpaulin.shahaf.local2>
On 3 Jan 2020, at 18:39, Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
> How about this (relative to master)? It fixes your original problem but
> retains the separate-sections behaviour for man pages specified by filename.
Oh, that's much smarter, thank you.
I do see some minor issues with it:
* It creates a confusing inconsistency where it will automatically complete
directories in the CWD, but not files (because files still need a / in the
argument)
* It offers directories first, which i think will be annoying in the more
common case of trying to complete a man page from the database/MANPATH
* It offers to complete paths unconditionally, which isn't actually supported
by some man implementations/modes (OpenBSD requires -l for example). We were
just assuming that the user knew what they were doing if they had a / in the
argument, which i think is probably still sufficient
* Plural description
How about something like the following, then?
On 3 Jan 2020, at 18:39, Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
> Aside:
>
> % compdef _f f
> % _f() _files -/
> % f Util/<TAB>
> .
> offers files, rather than nothing. Bug?
I seem to recall this being discussed before, and it isn't really a bug, but
we could change it if we decided to. Someone was complaining about it on IRC
just the other day. I think we'd simply need to remove *:all-files from
pats=(...)
dana
diff --git a/Completion/Unix/Command/_man b/Completion/Unix/Command/_man
index 41ae85a1f..7d55201e3 100644
--- a/Completion/Unix/Command/_man
+++ b/Completion/Unix/Command/_man
@@ -381,7 +381,12 @@ _man() {
(( $#sects )) || return 1
- _tags manuals.${^sects}
+ if [[ $PREFIX$SUFFIX == */* ]]; then
+ _tags manuals.${^sects} files
+ else
+ _tags manuals.${^sects}
+ fi
+
while _tags; do
for sect_dirname in $sects; do
d=$sect_dirname
@@ -390,6 +395,8 @@ _man() {
_requested manuals.$sect_dirname expl "manual page, section $d" _man_pages &&
ret=0
done
+ [[ $PREFIX$SUFFIX == */* ]] &&
+ _requested files expl directory _files -/ && ret=0
(( ret )) || return 0
done
## To fall back to other sections' manpages when completing filenames, like
next prev parent reply other threads:[~2020-01-04 1:16 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
2020-01-04 1:17 ` dana [this message]
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=07B00625-9EC2-454E-B3E0-6F520DE4A899@dana.is \
--to=dana@dana.is \
--cc=d.s@daniel.shahaf.name \
--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).