zsh-users
 help / color / mirror / code / Atom feed
* ssh user name completion
@ 2006-10-04 11:17 Angelina Carlton
  2006-10-05 13:21 ` Peter Stephenson
  0 siblings, 1 reply; 4+ messages in thread
From: Angelina Carlton @ 2006-10-04 11:17 UTC (permalink / raw)
  To: zsh-users


Hello everyone,

I have several computers running various flavours of Debian GNU/Linux
On my server, (Debian stable)  I have installed the package zsh-beta:
zsh-beta  4.3.0-dev-2+20 A shell with lots of features (dev tree)

On my desktop, (Debian unstable) I also have zsh-beta:
zsh-beta  4.3.2-dev-1+20060928-1 A shell with lots of features (dev
tree)

in my ~/.zshrc on both machines:

#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..

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.

Obviously I would like the version of zsh on Debian unstable to behave
(at least with respects to ssh completion) just like the version of zsh
on Debian stable. 

Does anyone know how to do this?
Thanks very much.

-- 
-----Angelina Carlton-----
orchid on irc.freenode.net
     brat@magma.ca
web:bzgirl.bakadigital.com
--------------------------


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: ssh user name completion
  2006-10-04 11:17 ssh user name completion Angelina Carlton
@ 2006-10-05 13:21 ` Peter Stephenson
  2006-10-05 21:18   ` Angelina Carlton
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Stephenson @ 2006-10-05 13:21 UTC (permalink / raw)
  To: zsh-users

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: ssh user name completion
  2006-10-05 13:21 ` Peter Stephenson
@ 2006-10-05 21:18   ` Angelina Carlton
  2006-10-05 21:42     ` Peter Stephenson
  0 siblings, 1 reply; 4+ messages in thread
From: Angelina Carlton @ 2006-10-05 21:18 UTC (permalink / raw)
  To: zsh-users

Peter Stephenson <pws@csr.com> writes:
>
> 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

Yes that works, thank you.
-- 
-----Angelina Carlton-----
orchid on irc.freenode.net
     brat@magma.ca
web:bzgirl.bakadigital.com
--------------------------


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: ssh user name completion
  2006-10-05 21:18   ` Angelina Carlton
@ 2006-10-05 21:42     ` Peter Stephenson
  0 siblings, 0 replies; 4+ messages in thread
From: Peter Stephenson @ 2006-10-05 21:42 UTC (permalink / raw)
  To: zsh-users

Angelina Carlton wrote:
> >   zstyle ":completion:*" users arthur brenda charlie deirdre
> 
> Yes that works, thank you.

Hmm... so it's not fundamentally broken... I don't know why it wouldn't
be able to query the operating system any more.

-- 
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-10-05 21:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-10-04 11:17 ssh user name completion Angelina Carlton
2006-10-05 13:21 ` Peter Stephenson
2006-10-05 21:18   ` Angelina Carlton
2006-10-05 21:42     ` Peter Stephenson

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).