From: "Bart Schaefer" <schaefer@brasslantern.com>
To: Jesper Holmberg <jesper.holmberg.5791@student.uu.se>,
Zsh-users List <zsh-users@sunsite.dk>
Subject: Re: How to get started with the completion system
Date: Sun, 21 Jul 2002 18:20:48 +0000 [thread overview]
Message-ID: <1020721182048.ZM28653@candle.brasslantern.com> (raw)
In-Reply-To: <20020721063741.GA623@strindberg.student.uu.se>
On Jul 21, 8:37am, Jesper Holmberg wrote:
} Subject: How to get started with the completion system
}
} I am afraid this is quite a stupid question, but I'm looking for
} information on how to get started customizing the (new) completion system.
Probably the best place to start is PWS's Zsh User Guide:
http://zsh.sunsite.dk/Guide/
} More specifically, I'd like scp to know my account names on remote hosts
} that I log into, and also maintain a list of these remote hosts, so that I
} can type "scp ./try.txt je <TAB> @ hos <TAB>" and have the parts before and
} after the at-sign completed.
There's been quite a bit of discussion about this on the mailing lists,
some of it quite recent. Unfortunately www.zsh.org is unreachable right
now (at least, I can't get to it) so I can't locate any examples.
So, here's what I use for ssh/scp; I don't promise it works perfectly,
because for one thing there is a known shortcoming in the way the
_combination utility (which is used by the _ssh completer) selects from
among multiple tags when generating listings, so you sometimes get more
choices than you expect; but it's mostly right:
----------
zstyle ':completion:*' format 'Completing %d'
zstyle ':completion:*' group-name ''
zstyle ':completion:*:scp:*' tag-order \
'hosts:-host hosts:-domain:domain hosts:-ipaddr:IP\ address *'
zstyle ':completion:*:scp:*' group-order \
users files all-files hosts-domain hosts-host hosts-ipaddr
zstyle ':completion:*:ssh:*' tag-order \
users 'hosts:-host hosts:-domain:domain hosts:-ipaddr:IP\ address *'
zstyle ':completion:*:ssh:*' group-order \
hosts-domain hosts-host users hosts-ipaddr
zstyle ':completion:*:(ssh|scp):*:hosts-host' ignored-patterns \
'*.*' loopback localhost
zstyle ':completion:*:(ssh|scp):*:hosts-domain' ignored-patterns \
'<->.<->.<->.<->' '^*.*' '*@*'
zstyle ':completion:*:(ssh|scp):*:hosts-ipaddr' ignored-patterns \
'^<->.<->.<->.<->' '127.0.0.<->'
zstyle ':completion:*:(ssh|scp):*:users' ignored-patterns \
adm bin daemon halt lp named shutdown sync
zstyle -e ':completion:*:(ssh|scp):*' hosts 'reply=(
${=${${(f)"$(cat {/etc/ssh_,~/.ssh/known_}hosts(|2)(N) \
/dev/null)"}%%[# ]*}//,/ }
${=${(f)"$(cat /etc/hosts(|)(N) <<(ypcat hosts 2>/dev/null))"}%%\#*}
)'
zstyle ':completion:*:(ssh|scp):*:my-accounts' users-hosts \
jesper.holmberg.5791@student.uu.se
----------
Obviously I edited that last one. You can add more of your own user@host
account names to the last line there.
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net
next prev parent reply other threads:[~2002-07-22 2:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-07-21 6:37 Jesper Holmberg
2002-07-21 18:20 ` Bart Schaefer [this message]
2002-07-24 13:26 ` Jesper Holmberg
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=1020721182048.ZM28653@candle.brasslantern.com \
--to=schaefer@brasslantern.com \
--cc=jesper.holmberg.5791@student.uu.se \
--cc=zsh-users@sunsite.dk \
/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).