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 201bde77 for ; Fri, 13 Dec 2019 19:47:53 +0000 (UTC) Received: (qmail 23847 invoked by alias); 13 Dec 2019 19:47:45 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: List-Unsubscribe: X-Seq: 24526 Received: (qmail 27776 invoked by uid 1010); 13 Dec 2019 19:47:45 -0000 X-Qmail-Scanner-Diagnostics: from mail-lf1-f51.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.1/25656. spamassassin: 3.4.2. Clear:RC:0(209.85.167.51):SA:0(-1.9/5.0):. Processed in 1.87933 secs); 13 Dec 2019 19:47:45 -0000 X-Envelope-From: schaefer@brasslantern.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.167.51 as permitted sender) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=9N3vF707bqW9tQDtALe8yHmB+ia5f8u8nTApFcLdHZo=; b=j0sy1NQEQBTcLe6i/WlhHE8bBPUWb+WG9vgETrwF+r/BWQD9Hx6x2HGyNqe1N9h9Bn rkzcjH6IpyYa5g6+qUaQFfrAcYsnpdpNx9ijm1kIGYba/2wnD/X7muDDRZ0YxALSvwP5 ExpersN1f0OFYErMHFnR7Ec0mClGjLpYIuU4sYHNeZQVN+NKPCnlSZ6NzFP/yLAUH/QT COpMepmPJsfkKxjz/AgNpt3WxQ4dk0DCZYUQa8JAkUZfUwi6y0wIAb4AIqnkQNgZ7Vv4 jtHKLcWYKataKvAkF+IYDlq3lsSE1ylO9MUX5S4We3voKsjlw7OJD8ceNviPvCvJ8Snu Ieow== X-Gm-Message-State: APjAAAXJL+fafdgihhx6QNA4GWMhzLToBeudE5TwP1xHLqcDiYOfpvXy l/iZJljxJFXguqEwldGUXuwZTinVRu2oZILithSLJA== X-Google-Smtp-Source: APXvYqyRRmL3lWdlyXj0kscT3ZLOBuK8PxHoRKKXDV8DeZFwzbH1IjTVP3E0s43jF2IuNc1MZ0X/rEXGHCmBJwrmwGo= X-Received: by 2002:a19:86d7:: with SMTP id i206mr9723160lfd.119.1576266427243; Fri, 13 Dec 2019 11:47:07 -0800 (PST) MIME-Version: 1.0 References: <1575995450.4447.3.camel@samsung.com> <1576254243.5214.21.camel@samsung.com> In-Reply-To: From: Bart Schaefer Date: Fri, 13 Dec 2019 11:46:56 -0800 Message-ID: Subject: Re: completion of filenames To: Ray Andrews Cc: Zsh Users Content-Type: text/plain; charset="UTF-8" On Fri, Dec 13, 2019 at 9:07 AM Ray Andrews wrote: > > Or not. Anyway for now I don't even know where to look. Let's take this all the way back to the beginning for a moment ... On Tue, Dec 10, 2019 at 8:19 AM Ray Andrews wrote: > > As I have it now TAB only completes filenames after some leading > command. If I hit TAB at the beginning of a line it seems to want to > find commands. Can I have filename completion active right from the > start? When there is nothing at all on the command line, completion starts out in the special "-command-" context. If you start from "zsh -f" and load the completion system (compinit) and then type ^x h (as previously suggested by PWS -- note, you have to let go of the ctrl key before hitting h) you will find this (apologies for any extraneous line wrapping): % tags in context :completion::complete:-command-:: commands builtins functions aliases suffix-aliases reserved-words jobs parameters parameters (_command_names _autocd) commands (_path_commands _path_commands _command_names _autocd) jobs (_jobs _command_names _autocd) parameters (_parameters _command_names _autocd) You'll notice that "files" are not in that description anywhere. If we add your "zstyle ':completion:*' completer _expand _complete _files" setting: % tags in context :completion::complete:-command-:: commands builtins functions aliases suffix-aliases reserved-words jobs parameters parameters (_command_names _autocd) commands (_path_commands _command_names _autocd) jobs (_jobs _command_names _autocd) parameters (_parameters _command_names _autocd) tags in context :completion::files::: globbed-files (_files) Now we have files, but they're still going to be tried only after all the more specific context has failed to locate anything. If you want files to be tried along with all of those other options, you need to put _files BEFORE _complete in the zstyle, and if you want that to happen only at an empty prompt, you need to use the specific -command- context. zstyle :completion::complete:-command-:: completer _expand _files _complete zstyle :completion::complete:-command-:: insert-tab false Note that when you form a list of completers, the implication is that if an earlier entry in the list finds ANY possible completion, then the later entries will not be tried. So at an empty prompt you are going to get either the default stuff from _complete, or the local files from _files, depending on which order those appear in the style. If you want both all the time, a different formulation would be needed. You've got one more issue, I think, based on your subsequent question: > Where is 'expand-or-complete' defined? You shouldn't be using both expand-or-complete and the _expand completer. If you invoke expand-or-complete, it's going to try to do expansion on the word and if that succeeds it will never proceed into attempting completion. To use _expand, you should be re-binding the TAB key: bindkey "^I" complete-word Usually compinit will take care of this for you, but only if the zstyle definitions appear in your .zshrc (et al) BEFORE you invoke compinit. This is in the doc: To initialize the system, the function compinit should be in a direc- tory mentioned in the fpath parameter ... If completion styles (see below) are set up to perform expansion as well as completion by default, and the TAB key is bound to expand-or-complete, compinit will rebind it to complete-word; this is necessary to use the correct form of expansion. Does any of this help with your situation?