zsh-users
 help / color / mirror / code / Atom feed
* How to get started with the completion system
@ 2002-07-21  6:37 Jesper Holmberg
  2002-07-21 18:20 ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Jesper Holmberg @ 2002-07-21  6:37 UTC (permalink / raw)
  To: Zsh-users List

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.
I have found information about how to get it up and runnig, and how to
write one's own functions, but I'd like to first of all explore what's
included "out of the box".

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.

So my question is twofold, I guess. How do I do the abovementioned, and
where could I have found out without bothering the list?

TIA

Jesper


-- 
Jesper Holmberg             "But how can one be warm alone?"
Studentstaden 19:312        
752 33 Uppsala              tel: +46 18 50 17 31
SWEDEN                      mob: +46 709 18 32 28


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

* Re: How to get started with the completion system
  2002-07-21  6:37 How to get started with the completion system Jesper Holmberg
@ 2002-07-21 18:20 ` Bart Schaefer
  2002-07-24 13:26   ` Jesper Holmberg
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 2002-07-21 18:20 UTC (permalink / raw)
  To: Jesper Holmberg, Zsh-users List

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   


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

* Re: How to get started with the completion system
  2002-07-21 18:20 ` Bart Schaefer
@ 2002-07-24 13:26   ` Jesper Holmberg
  0 siblings, 0 replies; 3+ messages in thread
From: Jesper Holmberg @ 2002-07-24 13:26 UTC (permalink / raw)
  To: Zsh-users List; +Cc: Bart Schaefer

* Also sprach Bart Schaefer am Sun Jul 21:
> Probably the best place to start is PWS's Zsh User Guide:
> 
> 	http://zsh.sunsite.dk/Guide/

Thanks, I'll just have to dig into it. I was thinking there might be some
sort of easier presentation of what's available right away, out of the
box. But I guess I was just too lazy. :-)


> So, here's what I use for ssh/scp;

Thanks, works great.

Jesper


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

end of thread, other threads:[~2002-07-24 13:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-21  6:37 How to get started with the completion system Jesper Holmberg
2002-07-21 18:20 ` Bart Schaefer
2002-07-24 13:26   ` Jesper Holmberg

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