From 25f5893a5b79ce00aa4369146dccc09f58a6b519 Mon Sep 17 00:00:00 2001 From: Stanislav Vorobyev Date: Wed, 1 Feb 2012 22:12:44 +0400 Subject: [PATCH 1/5] better install script --- tools/install.sh | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/tools/install.sh b/tools/install.sh index aedb706da..238f856cf 100755 --- a/tools/install.sh +++ b/tools/install.sh @@ -1,25 +1,25 @@ -if [ -d ~/.oh-my-zsh ] +if [ -d $HOME/.oh-my-zsh ] then - echo "\033[0;33mYou already have Oh My Zsh installed.\033[0m You'll need to remove ~/.oh-my-zsh if you want to install" + echo "\033[0;33mYou already have Oh My Zsh installed.\033[0m You'll need to remove $HOME/.oh-my-zsh if you want to install" exit fi echo "\033[0;34mCloning Oh My Zsh...\033[0m" -/usr/bin/env git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh +/usr/bin/env git clone https://github.com/robbyrussell/oh-my-zsh.git $HOME/.oh-my-zsh echo "\033[0;34mLooking for an existing zsh config...\033[0m" -if [ -f ~/.zshrc ] || [ -h ~/.zshrc ] +if [ -f $HOME/.zshrc ] || [ -h $HOME/.zshrc ] then - echo "\033[0;33mFound ~/.zshrc.\033[0m \033[0;32]Backing up to ~/.zshrc.pre-oh-my-zsh\033[0m"; - cp ~/.zshrc ~/.zshrc.pre-oh-my-zsh; - rm ~/.zshrc; + echo "\033[0;33mFound $HOME/.zshrc.\033[0m \033[0;32]Backing up to $HOME/.zshrc.pre-oh-my-zsh\033[0m"; + cp $HOME/.zshrc $HOME/.zshrc.pre-oh-my-zsh; + rm $HOME/.zshrc; fi -echo "\033[0;34mUsing the Oh My Zsh template file and adding it to ~/.zshrc\033[0m" -cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc +echo "\033[0;34mUsing the Oh My Zsh template file and adding it to $HOME/.zshrc\033[0m" +cp $HOME/.oh-my-zsh/templates/zshrc.zsh-template $HOME/.zshrc -echo "\033[0;34mCopying your current PATH and adding it to the end of ~/.zshrc for you.\033[0m" -echo "export PATH=$PATH" >> ~/.zshrc +echo "\033[0;34mCopying your current PATH and adding it to the end of $HOME/.zshrc for you.\033[0m" +echo "export PATH=$PATH" >> $HOME/.zshrc echo "\033[0;34mTime to change your default shell to zsh!\033[0m" chsh -s `which zsh` @@ -33,4 +33,4 @@ echo "\033[0;32m"' /____/ '"\033[0m echo "\n\n \033[0;32m....is now installed.\033[0m" /usr/bin/env zsh -source ~/.zshrc +source $HOME/.zshrc From 7eef2680e743cc5c5857febc4fdb98086fbaae60 Mon Sep 17 00:00:00 2001 From: Stanislav Vorobyev Date: Wed, 1 Feb 2012 22:27:25 +0400 Subject: [PATCH 2/5] ensure zshrc exists --- tools/install.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/install.sh b/tools/install.sh index 238f856cf..17181c04b 100755 --- a/tools/install.sh +++ b/tools/install.sh @@ -33,4 +33,5 @@ echo "\033[0;32m"' /____/ '"\033[0m echo "\n\n \033[0;32m....is now installed.\033[0m" /usr/bin/env zsh +touch ~/.zshrc source $HOME/.zshrc From c356acdcf385d23bf83c73b4a3011c3e726fc7e3 Mon Sep 17 00:00:00 2001 From: Stanislav Vorobyev Date: Wed, 1 Feb 2012 22:29:34 +0400 Subject: [PATCH 3/5] correct color --- tools/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/install.sh b/tools/install.sh index 17181c04b..6a5f39bc2 100755 --- a/tools/install.sh +++ b/tools/install.sh @@ -10,7 +10,7 @@ echo "\033[0;34mCloning Oh My Zsh...\033[0m" echo "\033[0;34mLooking for an existing zsh config...\033[0m" if [ -f $HOME/.zshrc ] || [ -h $HOME/.zshrc ] then - echo "\033[0;33mFound $HOME/.zshrc.\033[0m \033[0;32]Backing up to $HOME/.zshrc.pre-oh-my-zsh\033[0m"; + echo "\033[0;33mFound $HOME/.zshrc.\033[0m \033[0;32mBacking up to $HOME/.zshrc.pre-oh-my-zsh\033[0m"; cp $HOME/.zshrc $HOME/.zshrc.pre-oh-my-zsh; rm $HOME/.zshrc; fi From 8520dad7d7fecd3da2f2452a7a531724e09ab328 Mon Sep 17 00:00:00 2001 From: Stanislav Vorobyev Date: Thu, 2 Feb 2012 02:19:05 +0400 Subject: [PATCH 4/5] started my theme --- themes/vissi.zsh-theme | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 themes/vissi.zsh-theme diff --git a/themes/vissi.zsh-theme b/themes/vissi.zsh-theme new file mode 100644 index 000000000..99a55b576 --- /dev/null +++ b/themes/vissi.zsh-theme @@ -0,0 +1,7 @@ +PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' +RPROMPT="%T %D" + +ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})" From b268f1515d80c33ccec5c3f279854b00f23daf0c Mon Sep 17 00:00:00 2001 From: Stanislav Vorobyev Date: Thu, 2 Feb 2012 17:08:28 +0400 Subject: [PATCH 5/5] battery charge (via habrahabr.ru) --- themes/vissi.zsh-theme | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/themes/vissi.zsh-theme b/themes/vissi.zsh-theme index 99a55b576..cd657e3ca 100644 --- a/themes/vissi.zsh-theme +++ b/themes/vissi.zsh-theme @@ -1,5 +1,23 @@ +function battery_charge { + # Battery 0: Discharging, 94%, 03:46:34 remaining + bat_percent=`acpi | awk -F ':' {'print $2;'} | awk -F ',' {'print $2;'} | sed -e "s/\s//" -e "s/%.*//"` + + if [ $bat_percent -lt 20 ]; then cl='%F{red}' + elif [ $bat_percent -lt 50 ]; then cl='%F{yellow}' + else cl='%F{green}' + fi + + filled=${(l:`expr $bat_percent / 10`::▸:)} + empty=${(l:`expr 10 - $bat_percent / 10`::▹:)} + echo $cl$filled$empty'%F{default}' +} + PROMPT='%{$fg_bold[red]%}➜ %{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' -RPROMPT="%T %D" +if [ -x /usr/bin/acpi ]; then + RPROMPT="%T %D $(battery_charge)" +else + RPROMPT="%T %D" +fi ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"