All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
3 # ssh configuration for zsh
5 # Copyright © 2008 martin f. krafft <madduck@madduck.net>
6 # Released under the terms of the Artistic Licence 2.0
8 # Source repository: git://git.madduck.net/etc/ssh.git
11 # populate hosts completion with SSH's known_hosts
12 if [ -r $HOME/.ssh/known_hosts ]; then
14 _myhosts=(${${${${(f)"$(cat $HOME/.ssh/known_hosts)"}:#[0-9]*}%%\ *}%%,*})
15 zstyle ':completion:*' hosts $_myhosts
20 local cmd sshopts cmdopts
22 sshopts="${*%%--*}"; sshopts="${sshopts%% }"
23 [[ -n "$sshopts" ]] || { ssh; return $? }
24 cmdopts="${*#$sshopts}"; cmdopts="${cmdopts#*-- }"
25 eval ssh $sshopts -t $cmd $cmdopts
28 # need functions instead of aliases for completion
29 rrsh() { _ssh_proxy "sudo -i" "$@" }
32 ttsh() { _ssh_proxy "tmux last" "$@" }
35 rtsh() { _ssh_proxy "tmux new sudo -i" "$@" }
38 declare _SSH_SOCKDIR="${VARDIR}/ssh"
40 if [[ -z "$1" ]]; then
41 rm -vf -- ${_SSH_SOCKDIR}/*(=as-60Y1omN)
46 compdef -e "compset -P ${_SSH_SOCKDIR}/ || PREFIX=${_SSH_SOCKDIR}/; _files -W ${_SSH_SOCKDIR}" kssh
49 local args host dir arg
53 (*:*) host=${arg%%:*}; dir="${arg#*:}";;
54 (*) args="${args:+$args }$arg";;
58 if [[ -z $dir ]]; then
63 ssh -t $args $host "cd '${dir:gs/\'/\'\\\'\'}' && exec \$SHELL --login"