From: Bart Schaefer <schaefer@brasslantern.com>
To: Miek Gieben <miek@miek.nl>, zsh-users@zsh.org
Subject: Re: default to file completion
Date: Fri, 23 Dec 2011 12:45:22 -0800 [thread overview]
Message-ID: <111223124522.ZM17185@torch.brasslantern.com> (raw)
In-Reply-To: <20111222230108.GA32237@miek.nl>
On Dec 23, 12:01am, Miek Gieben wrote:
}
} > > ./scan -zone <TAB>
} > >
} > > And nothing gets completed. How can I tell zsh to fallback to filename
} > > completion at that point?
} >
} > "scan" is a command that already has completion in zsh
}
} Is there a way to disable the default completion for the
} command 'scan' if you start it with './' ?
You can intercept completion pretty early on by providing a compdef for
the special context "-first-".
-first-
This is tried before any other completion function. The function
called may set the _compskip parameter to one of various values:
all: no further completion is attempted; a string containing the
substring patterns: no pattern completion functions will be
called; a string containing default: the function for the
`-default-' context will not be called, but functions defined for
commands will [be]
Although it's not documented in the man pages, this can also be done by
redefining the function _first (which by default is a no-op). Hence:
_first() {
if [[ CURRENT -gt 1 && "${words[1]}" = ./* ]];
then
_compskip=all
_files
fi
}
There's a much more complicated example as a large comment in the _first
function that is supplied with the shell.
next prev parent reply other threads:[~2011-12-23 20:45 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 ` Bart Schaefer [this message]
2011-12-25 10:32 ` default to file completion Miek Gieben
2011-12-20 19:38 ` gi1242+zsh
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=111223124522.ZM17185@torch.brasslantern.com \
--to=schaefer@brasslantern.com \
--cc=miek@miek.nl \
--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).