Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Using another command's completion function with an alias
- X-seq: zsh-users 14561
- From: "Benjamin R. Haskell" <zsh@xxxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: Using another command's completion function with an alias
- Date: Thu, 12 Nov 2009 14:00:56 -0500 (EST)
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
Back in March, Bart Schaefer recommended the following useful advice for
getting 'sshfs' to use the completion for 'scp':
compdef sshfs=scp
I have several commands that I use regularly that do some setup of the
environment or other kinds of filtering. For example, daemontools'
fixcrio fixes up LF line endings to emit CRLF:
Usage is roughly: fixcrio program [args]
E.g. fixcrio nc mail.example.com smtp
I managed to get the ones that are commands to work the way I want them to
by using:
compdef commandname=-command-
I also have some that are straightforward enough to set them as
aliases.
alias noagent='env -u SSH_AGENT_PID -u SSH_AUTH_SOCK'
But, compdef noagent=-command- doesn't have the desired effect. I
instead get the completion for 'env':
$ noagent <C-x><h>
tags in context :completion::complete:-u::
all-files (_files _default (eval))
tags in context :completion::complete:env::
argument-rest (_arguments _env (eval))
Obviously my completion-fu is still in its infancy. Is there something
simple to fix the 'alias' version?
Also, commandname=-command- works fine for my purposes. But, '-command-'
is too general: for starters, it also picks up builtins and aliases. Is
there something better I should use?
Thanks,
Ben
Messages sorted by:
Reverse Date,
Date,
Thread,
Author