Rename the damn-mac theme
This commit is contained in:
parent
a3655b3f70
commit
9eff0fdd3d
|
@ -1,58 +0,0 @@
|
|||
# damn-mac.zsh-theme
|
||||
#
|
||||
# Author: @lxsameer <lxsameer@gnu.org>
|
||||
# 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}%F{002}> "
|
||||
else
|
||||
echo "%F{001}# "
|
||||
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}]"
|
|
@ -1,4 +1,4 @@
|
|||
# lxsameer.zsh-theme
|
||||
# damn-mac.zsh-theme
|
||||
#
|
||||
# Author: @lxsameer <lxsameer@gnu.org>
|
||||
# Repo: https://github.com/lxsameer/My.Zsh
|
||||
|
@ -8,21 +8,9 @@
|
|||
function my_git_prompt_info() {
|
||||
ref=$(git symbolic-ref HEAD 2> /dev/null) || \
|
||||
ref=$(git rev-parse --short HEAD 2> /dev/null) || return
|
||||
echo "$(my_commits) $(count_commits) $ZSH_THEME_GIT_PROMPT_PREFIX %F{007}$(parse_git_dirty)%F{005}${ref#refs/heads/} %F{007}\uf126 $ZSH_THEME_GIT_PROMPT_SUFFIX"
|
||||
echo "$ZSH_THEME_GIT_PROMPT_PREFIX %F{007}$(parse_git_dirty)%F{005}${ref#refs/heads/} %F{007}$ZSH_THEME_GIT_PROMPT_SUFFIX"
|
||||
}
|
||||
|
||||
function count_commits () {
|
||||
count="$(git rev-list --all --count)"
|
||||
formatted="$(printf "%05d" $count)"
|
||||
echo "%F{008}$formatted \uf02c"
|
||||
}
|
||||
|
||||
function my_commits () {
|
||||
commits="$(git shortlog -s -n|grep 'Sameer Rahmani'|cut -f 1)"
|
||||
result="${commits// /}"
|
||||
formatted="$(printf "%04d" $result)"
|
||||
echo "%F{002}$formatted \uf1ae"
|
||||
}
|
||||
function get_pwd() {
|
||||
echo "${PWD/$HOME/~}"
|
||||
}
|
||||
|
@ -32,16 +20,16 @@ function spaces() {
|
|||
if [ ${#git} != 0 ]; then
|
||||
local clean=$(parse_git_dirty)
|
||||
if [ ${#clean} != 0 ]; then
|
||||
(( git = ${#git} - 48 - ${#clean} + 1 ))
|
||||
(( git = ${#git} - 34 - ${#clean} + 1 ))
|
||||
else
|
||||
(( git = ${#git} - 48 ))
|
||||
(( git = ${#git} - 34 ))
|
||||
fi
|
||||
else
|
||||
git=0
|
||||
fi
|
||||
|
||||
local termwidth
|
||||
(( termwidth = ${COLUMNS} - 18 - ${#$(get_pwd)} - ${git} ))
|
||||
(( termwidth = ${COLUMNS} - 3 - ${#$(get_pwd)} - ${git} ))
|
||||
|
||||
local spacing=" "
|
||||
for i in {1..$termwidth}; do
|
||||
|
@ -49,32 +37,19 @@ function spaces() {
|
|||
done
|
||||
echo $spacing
|
||||
}
|
||||
function user_sign () {
|
||||
|
||||
function user_prompt () {
|
||||
if [ $UID != 0 ]; then
|
||||
echo "%F{002}\uf058"
|
||||
echo "%F{007}%F{002}> "
|
||||
else
|
||||
echo "%F{001}\uf071"
|
||||
echo "%F{001}# "
|
||||
fi
|
||||
}
|
||||
|
||||
function path_icon () {
|
||||
echo "%F{004}\uf0c1"
|
||||
}
|
||||
|
||||
function code_icon () {
|
||||
echo "%F{007}\uf121 "
|
||||
}
|
||||
|
||||
function last_command_result () {
|
||||
echo "%F{005}%? \uf128"
|
||||
}
|
||||
|
||||
function num_jobs () {
|
||||
echo "%F{004}%j \uf013"
|
||||
}
|
||||
PROMPT='
|
||||
$(user_sign) %F{007}[ $(last_command_result) $(num_jobs) %F{007}] %F{003}%~%F{008}$(spaces) $(my_git_prompt_info)
|
||||
$(code_icon)%f'
|
||||
%F{005}%~%F{008}$(spaces) $(my_git_prompt_info)
|
||||
$(user_prompt)%f'
|
||||
|
||||
# git settings
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX="%F{002}["
|
||||
|
|
Loading…
Reference in New Issue