zsh-users
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@csr.com>
To: zsh-users@sunsite.dk
Subject: Re: ssh user name completion
Date: Thu, 5 Oct 2006 14:21:57 +0100	[thread overview]
Message-ID: <20061005142157.f245ae41.pws@csr.com> (raw)
In-Reply-To: <87ejtotjnt.fsf@magma.ca>

Angelina Carlton <brat@magma.ca> wrote:
> #ssh completion
> local _myhosts;
> _myhosts=( ${${=${${(f)"$(cat {/etc/ssh_,~/.ssh/known_}hosts(|2)(N) /dev/null)"}%%[# ]*}//,/ }:#\!*}
> ${=${(f)"$(cat /etc/hosts(|)(N) <<EOF
> (ypcat hosts 2>/dev/null))"}%%\#*} );
> zstyle ':completion:*' hosts $_myhosts;
> 
> I got this code from a zshrc I found on the net, but i don't pretend to
> understand how exactly it works, or even if it is the correct way to do
> ssh conmpletion..

You should find recent versions of zsh have this in by default.

> The problem is on the Debian Stable server, if I type:
> ssh u<TAB>
> the shell expands to:
> ssh username@
> then I type the first letter of the host and it expands that as well.
> This is excellent behaviour and makes things very fast.
> 
> However on my Debian unstable computer, typing:
> ssh u<TAB>
> will just make the shell beep, as it seems not to know how to complete
> the command. I have to manually type in the username@ string and then it
> will complete the hostname for me.

The code you show doesn't do anything special for user names.  The current
support built into the completion system adds any users stored in the
style "users", then any found by scanning the system's password database.
This doesn't appear to have changed recently.

Try setting a few user names for it to complete explicitly and see
if that works:

  zstyle ":completion:*" users arthur brenda charlie deirdre


To access the latest news from CSR copy this link into a web browser:  http://www.csr.com/email_sig.php


  reply	other threads:[~2006-10-05 13:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-10-04 11:17 Angelina Carlton
2006-10-05 13:21 ` Peter Stephenson [this message]
2006-10-05 21:18   ` Angelina Carlton
2006-10-05 21:42     ` Peter Stephenson

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=20061005142157.f245ae41.pws@csr.com \
    --to=pws@csr.com \
    --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).