From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1398 invoked from network); 22 Jul 2002 02:39:23 -0000 Received: from ns2.primenet.com.au (HELO primenet.com.au) (203.24.36.3) by ns1.primenet.com.au with SMTP; 22 Jul 2002 02:39:23 -0000 Received: (qmail 15364 invoked from network); 21 Jul 2002 18:22:37 -0000 Received: from sunsite.dk (130.225.247.90) by proxy.melb.primenet.com.au with SMTP; 21 Jul 2002 18:22:37 -0000 Received: (qmail 146 invoked by alias); 21 Jul 2002 18:21:21 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 5184 Received: (qmail 134 invoked from network); 21 Jul 2002 18:21:20 -0000 From: "Bart Schaefer" Message-Id: <1020721182048.ZM28653@candle.brasslantern.com> Date: Sun, 21 Jul 2002 18:20:48 +0000 In-Reply-To: <20020721063741.GA623@strindberg.student.uu.se> Comments: In reply to Jesper Holmberg "How to get started with the completion system" (Jul 21, 8:37am) References: <20020721063741.GA623@strindberg.student.uu.se> X-Mailer: Z-Mail (5.0.0 30July97) To: Jesper Holmberg , Zsh-users List Subject: Re: How to get started with the completion system MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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 @ hos " 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