diff --git a/oh-my-zsh.zsh b/oh-my-zsh.zsh index 9334778fe..779021369 100644 --- a/oh-my-zsh.zsh +++ b/oh-my-zsh.zsh @@ -45,7 +45,7 @@ for plugin ($plugins); do done local ZSH_THEME -zstyle -a :omz theme ZSH_THEME +zstyle -a :omz:style theme ZSH_THEME # Load the theme if [ "$ZSH_THEME" = "random" ] diff --git a/plugins/keychain/keychain.plugin.zsh b/plugins/keychain/keychain.plugin.zsh index 0f233812e..cca7a7f5d 100644 --- a/plugins/keychain/keychain.plugin.zsh +++ b/plugins/keychain/keychain.plugin.zsh @@ -1,6 +1,4 @@ -local ssh_env=$HOME/.ssh/environment-$HOST - -function start_agent() +function keychain_start_agent() { local -a identities @@ -15,23 +13,23 @@ function start_agent() } function keychain() { + local ssh_env=$HOME/.ssh/environment-$HOST + case $1 in - "start") ;; + "start") + if [[ -f $ssh_env ]]; then + source $ssh_env >/dev/null + ps -p $SSH_AGENT_PID >/dev/null || keychain_start_agent + else + keychain_start_agent; + fi + ;; "kill") - ssh-agent -k + echo "Stopping agent" + ssh-agent -k >/dev/null && [[ -f $ssh_env ]] && rm $ssh_env ;; esac } zstyle -a :omz:plugins:keychain autostart state -if [[ $state == "on" ]]; then - if [[ -f $ssh_env ]]; then - source $ssh_env >/dev/null - ps -p $SSH_AGENT_PID >/dev/null || start_agent - else - start_agent; - fi -fi - -unfunction start_agent -unset ssh_env +[[ $state == "on" ]] && keychain start diff --git a/templates/user.zsh-template b/templates/user.zsh-template index ff9442106..51f3df690 100644 --- a/templates/user.zsh-template +++ b/templates/user.zsh-template @@ -1,7 +1,7 @@ # Check /etc/zsh/zshrc for system defaults. -ZSH_THEME="arch-blue" +zstyle :omz:style theme "arch-blue" plugins=(archlinux sprunge git github) -load_oh_my_zshell +omz_init diff --git a/templates/zshrc.arch-zsh-template b/templates/zshrc.arch-zsh-template index 875de0228..09f51c8f7 100644 --- a/templates/zshrc.arch-zsh-template +++ b/templates/zshrc.arch-zsh-template @@ -1,8 +1,9 @@ ZSH=/usr/share/oh-my-zsh -zstyle -a :omz theme "arch-blue" +zstyle :omz:style theme "arch-blue" + plugins=(archlinux sprunge) -omz_init(){ +omz_init() { source $ZSH/oh-my-zsh.zsh }