From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id 56bbbe44 for ; Sat, 4 Jan 2020 00:40:03 +0000 (UTC) Received: (qmail 21012 invoked by alias); 4 Jan 2020 00:39:58 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 45223 Received: (qmail 21717 invoked by uid 1010); 4 Jan 2020 00:39:58 -0000 X-Qmail-Scanner-Diagnostics: from out4-smtp.messagingengine.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.1/25677. spamassassin: 3.4.2. Clear:RC:0(66.111.4.28):SA:0(-2.6/5.0):. Processed in 5.196871 secs); 04 Jan 2020 00:39:58 -0000 X-Envelope-From: d.s@daniel.shahaf.name X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at daniel.shahaf.name does not designate permitted sender hosts) X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrvdeggedgvdehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpeffhffvuffkfhggtggujggfsehttd dttddtredvnecuhfhrohhmpeffrghnihgvlhcuufhhrghhrghfuceougdrshesuggrnhhi vghlrdhshhgrhhgrfhdrnhgrmhgvqeenucfkphepjeelrddukedtrdehjedrudduleenuc frrghrrghmpehmrghilhhfrhhomhepugdrshesuggrnhhivghlrdhshhgrhhgrfhdrnhgr mhgvnecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Date: Sat, 4 Jan 2020 00:39:13 +0000 From: Daniel Shahaf To: dana Cc: Zsh hackers list Subject: Re: [PATCH] Improve _man file-path completion Message-ID: <20200104003913.3gq5hnlmhndwbzz4@tarpaulin.shahaf.local2> References: <83C0ABA0-99A5-4DAD-98D6-DBB919F61E24@dana.is> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <83C0ABA0-99A5-4DAD-98D6-DBB919F61E24@dana.is> User-Agent: NeoMutt/20170113 (1.7.2) 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 > 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/ . offers files, rather than nothing. Bug?