From 9a1a3a3bf3b72d18adfa9ab35a6955aa9cc256dc Mon Sep 17 00:00:00 2001 From: Sameer Rahmani Date: Tue, 29 May 2018 20:49:55 +0100 Subject: [PATCH] 'damn-mac' theme has been added --- themes/damn-mac.zsh-theme | 58 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 themes/damn-mac.zsh-theme diff --git a/themes/damn-mac.zsh-theme b/themes/damn-mac.zsh-theme new file mode 100644 index 0000000..8c6c227 --- /dev/null +++ b/themes/damn-mac.zsh-theme @@ -0,0 +1,58 @@ +# damn-mac.zsh-theme +# +# Author: @lxsameer +# Repo: https://github.com/lxsameer/My.Zsh +# +# Created on: Apr 10, 2012 + +function my_git_prompt_info() { + ref=$(git symbolic-ref HEAD 2> /dev/null) || \ + ref=$(git rev-parse --short HEAD 2> /dev/null) || return + echo "$ZSH_THEME_GIT_PROMPT_PREFIX %F{007}$(parse_git_dirty)%F{005}${ref#refs/heads/} %F{007}$ZSH_THEME_GIT_PROMPT_SUFFIX" +} + +function get_pwd() { + echo "${PWD/$HOME/~}" +} +function spaces() { + local git=$(my_git_prompt_info) + + if [ ${#git} != 0 ]; then + local clean=$(parse_git_dirty) + if [ ${#clean} != 0 ]; then + (( git = ${#git} - 34 - ${#clean} + 1 )) + else + (( git = ${#git} - 34 )) + fi + else + git=0 + fi + + local termwidth + (( termwidth = ${COLUMNS} - 3 - ${#$(get_pwd)} - ${git} )) + + local spacing=" " + for i in {1..$termwidth}; do + spacing="${spacing}-" + done + echo $spacing +} + +function user_prompt () { + if [ $UID != 0 ]; then + echo "%F{007}$USER%F{002}> " + else + echo "%F{001}$USER# " + fi +} + + +PROMPT=' + %F{005}%~%F{008}$(spaces) $(my_git_prompt_info) + $(user_prompt)%f' + +# git settings +ZSH_THEME_GIT_PROMPT_PREFIX="%F{002}[" +ZSH_THEME_GIT_PROMPT_CLEAN="" +ZSH_THEME_GIT_PROMPT_DIRTY="%F{003}*" +ZSH_THEME_GIT_PROMPT_SUFFIX="%F{002}]"