zsh-users
 help / color / mirror / code / Atom feed
From: gi1242+zsh@gmail.com
To: Zsh users <zsh-users@zsh.org>
Subject: Re: default to file completion
Date: Tue, 20 Dec 2011 14:38:30 -0500	[thread overview]
Message-ID: <20111220193830.GA1192@andrew.cmu.edu> (raw)
In-Reply-To: <20111218101116.GA4446@miek.nl>

[-- Attachment #1: Type: text/plain, Size: 1533 bytes --]

On Sun, Dec 18, 2011 at 11:11:32AM +0100, Miek Gieben wrote:

> I've tried searching a bit, but I can not seem to find this specific
> problem. I've enablef completion in zsh and now I'm running a program
> of my own making (hence unknown to zsh): 'scan'
> 
> If I use tab completion the following happens:
> 
>     ./scan -zone <TAB>
> 
> And nothing gets completed. How can I tell zsh to fallback to filename
> completion at that point?

Here's an alternative to a case by case disabling of zsh completion, or
renaming commands.

    1. To plain old fall back on filename completion:

	    zstyle ':completion:*' completer _expand _complete _files \
		_correct _approximate

       The important thing above is the "_files" entry. This means if
       expansion or completion fails, it will try filename completion.
       (If that fails too, it will try correction or approximation.)

    2. Define a widgit that just completes files, and bind it to
       something (e.g. <C-X>f, in the example below).

	    zle -C complete-file menu-expand-or-complete _generic
	    zstyle ':completion:complete-file:*' completer _files
	    bindkey -M viins '^Xf'      complete-file
    
       (Change -M viins to -M emacs if you don't use VI keys)

       This allows you to complete files anywhere, on any command, at
       any time, by pressing <C-X>f (i.e. Control X, followed by f).

GI

-- 
100 THINGS I'D DO IF I EVER BECAME AN EVIL OVERLORD
34. I will not turn into a snake. It never helps.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

      parent reply	other threads:[~2011-12-20 19:55 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-18 10:11 Miek Gieben
2011-12-18 13:57 ` Mikael Magnusson
2011-12-18 15:20   ` Miek Gieben
2011-12-22 23:01   ` Miek Gieben
2011-12-22 23:42     ` '$1' indexing Ray Andrews
2011-12-23  0:11       ` Bart Schaefer
2011-12-23  2:08         ` Ray Andrews
2011-12-23 20:56           ` Bart Schaefer
2011-12-23 20:45     ` default to file completion Bart Schaefer
2011-12-25 10:32       ` Miek Gieben
2011-12-20 19:38 ` gi1242+zsh [this message]

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=20111220193830.GA1192@andrew.cmu.edu \
    --to=gi1242+zsh@gmail.com \
    --cc=zsh-users@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).