From 10bdcb3951c2aac763af3ac5d68a015ec110ce32 Mon Sep 17 00:00:00 2001 From: Jeremy Knope Date: Tue, 3 Apr 2012 11:58:32 -0400 Subject: [PATCH 1/2] added ssh-copy-id plugin for use on machines without it built-in --- plugins/ssh-copy-id/ssh-copy-id.plugin.zsh | 53 ++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 plugins/ssh-copy-id/ssh-copy-id.plugin.zsh diff --git a/plugins/ssh-copy-id/ssh-copy-id.plugin.zsh b/plugins/ssh-copy-id/ssh-copy-id.plugin.zsh new file mode 100644 index 000000000..57a0e8527 --- /dev/null +++ b/plugins/ssh-copy-id/ssh-copy-id.plugin.zsh @@ -0,0 +1,53 @@ +# There's probably a better way to define this if +ssh-upload-id () { + RSAKEY="${HOME}/.ssh/id_rsa.pub" + DSAKEY="${HOME}/.ssh/id_dsa.pub" + + if [ $# -eq 2 ]; then + KEY=$1 + if [ ! -r $KEY ] + then + echo "'$KEY' does not exist or is not readable" + return 1 + fi + SERVER=$2 + else + if [ -r ${RSAKEY} ]; then + KEY=$RSAKEY + elif [ -r ${DSAKEY} ]; then + KEY=$RSAKEY + else + echo "No RSA or DSA key found" + return 1 + fi + SERVER=$1 + fi + + if [ $# -lt 1 -o "$1" = "-h" ]; then + echo "Usage: $0 [publickey_file] [user@]machine" + return 1 + fi + + # testing above + + echo "Copying $KEY to $SERVER" + + cat $KEY | \ + ssh $SERVER 'mkdir -p -m 0700 ${HOME}/.ssh && \ + cat >> $HOME/.ssh/authorized_keys && \ + chmod 0600 $HOME/.ssh/authorized_keys' + + if [ $? -eq 0 ]; then + echo "Public key installed on $SERVER" + return 0 + else + echo "Sorry, an error occurred!" + return 1 + fi +} + +# alias it to ssh-copy-id if it doesn't exist, like on OS X +EXISTING_CHECK=`which ssh-copy-id` +if [ $? -ne 0 ]; then + alias ssh-copy-id=ssh-upload-id +fi From ff66bbd57027224eedce118255e5273e63557ec8 Mon Sep 17 00:00:00 2001 From: Jeremy Knope Date: Wed, 25 Apr 2012 17:30:48 -0400 Subject: [PATCH 2/2] added my own theme --- themes/jfro.zsh-theme | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 themes/jfro.zsh-theme diff --git a/themes/jfro.zsh-theme b/themes/jfro.zsh-theme new file mode 100644 index 000000000..4309894f2 --- /dev/null +++ b/themes/jfro.zsh-theme @@ -0,0 +1,22 @@ +# ZSH Theme - Preview: http://dl.dropbox.com/u/1552408/Screenshots/2010-04-08-oh-my-zsh.png + +if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="green"; fi +local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" + +crop_pwd() { + ((MAXMID=$COLUMNS / 2)) # truncate to this value + mypath="%~" + echo -n "%$MAXMID<...<$mypath" +} + +PROMPT='%{$fg[$NCOLOR]%}%n%{$fg[green]%}@%m%{$reset_color%} $(crop_pwd) \ +$(git_prompt_info)\ +%{$fg[red]%}%(!.#.»)%{$reset_color%} ' +PROMPT2='%{$fg[red]%}\ %{$reset_color%}' +RPS1='${return_code}' + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}±%{$fg[yellow]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} " +ZSH_THEME_GIT_PROMPT_CLEAN="" +ZSH_THEME_GIT_PROMPT_DIRTY="⚡" +