From ea4d4c56d2ed8d860fd5538213e8404bb971a232 Mon Sep 17 00:00:00 2001 From: Mulia Arifandi Nasution Date: Thu, 8 Oct 2015 07:37:25 +0700 Subject: [PATCH] Improve code readability --- plugins/themes/themes.plugin.zsh | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/plugins/themes/themes.plugin.zsh b/plugins/themes/themes.plugin.zsh index 18a64934..905f5e45 100644 --- a/plugins/themes/themes.plugin.zsh +++ b/plugins/themes/themes.plugin.zsh @@ -1,22 +1,20 @@ function theme { if [ -z "$1" ] || [ "$1" = "random" ]; then - themes=($ZSH/themes/*zsh-theme) - N=${#themes[@]} - ((N=(RANDOM%N)+1)) - RANDOM_THEME=${themes[$N]} - source "$RANDOM_THEME" - echo "[oh-my-zsh] Random theme '$RANDOM_THEME' loaded..." + themes=($ZSH/themes/*zsh-theme) + N=${#themes[@]} + ((N=(RANDOM%N)+1)) + RANDOM_THEME=${themes[$N]} + source "$RANDOM_THEME" + echo "[oh-my-zsh] Random theme '$RANDOM_THEME' loaded..." else - if [ -f "$ZSH_CUSTOM/$1.zsh-theme" ] - then - source "$ZSH_CUSTOM/$1.zsh-theme" - elif [ -f "$ZSH_CUSTOM/themes/$1.zsh-theme" ] - then - source "$ZSH_CUSTOM/themes/$1.zsh-theme" - else - source "$ZSH/themes/$1.zsh-theme" - fi + if [ -f "$ZSH_CUSTOM/$1.zsh-theme" ]; then + source "$ZSH_CUSTOM/$1.zsh-theme" + elif [ -f "$ZSH_CUSTOM/themes/$1.zsh-theme" ]; then + source "$ZSH_CUSTOM/themes/$1.zsh-theme" + else + source "$ZSH/themes/$1.zsh-theme" + fi fi }