Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 80 lines (67 sloc) 3.317 kB
c249c69 @kerimdzhanov Remove all copyright information in themes. Closes #2587
kerimdzhanov authored
1 # dogenpunk.zsh-theme
16f9dfb @dogenpunk Adding dogenpunk theme
dogenpunk authored
2
3 MODE_INDICATOR="%{$fg_bold[red]%}❮%{$reset_color%}%{$fg[red]%}❮❮%{$reset_color%}"
4 local return_status="%{$fg[red]%}%(?..⏎)%{$reset_color%}"
5
6 PROMPT='%{$fg[blue]%}%m%{$reset_color%}%{$fg_bold[white]%} ओम् %{$reset_color%}%{$fg[cyan]%}%~:%{$reset_color%}$(git_time_since_commit)$(git_prompt_info)
7 %{$fg[red]%}%!%{$reset_color%} $(prompt_char) '
8
9 ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[green]%}git%{$reset_color%}@%{$bg[white]%}%{$fg[black]%}"
10 ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%})"
11 ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}!%{$reset_color%}"
12 ZSH_THEME_GIT_PROMPT_CLEAN=""
13
14 RPROMPT='${return_status}$(git_prompt_status)%{$reset_color%}'
15
16 ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[green]%} ✚"
17 ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[blue]%} ✹"
18 ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%} ✖"
19 ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[magenta]%} ➜"
20 ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[yellow]%} ═"
21 ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[cyan]%} ✭"
22
23 function prompt_char() {
24 git branch >/dev/null 2>/dev/null && echo "%{$fg[green]%}±%{$reset_color%}" && return
25 hg root >/dev/null 2>/dev/null && echo "%{$fg_bold[red]%}☿%{$reset_color%}" && return
26 echo "%{$fg[cyan]%}◯ %{$reset_color%}"
27 }
28
29 # Colors vary depending on time lapsed.
30 ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT="%{$fg[green]%}"
31 ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM="%{$fg[yellow]%}"
32 ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG="%{$fg[red]%}"
33 ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL="%{$fg[cyan]%}"
34
35 # Determine the time since last commit. If branch is clean,
36 # use a neutral color, otherwise colors will vary according to time.
37 function git_time_since_commit() {
38 if git rev-parse --git-dir > /dev/null 2>&1; then
39 # Only proceed if there is actually a commit.
40 if [[ $(git log 2>&1 > /dev/null | grep -c "^fatal: bad default revision") == 0 ]]; then
41 # Get the last commit.
42 last_commit=`git log --pretty=format:'%at' -1 2> /dev/null`
43 now=`date +%s`
44 seconds_since_last_commit=$((now-last_commit))
45
46 # Totals
47 MINUTES=$((seconds_since_last_commit / 60))
48 HOURS=$((seconds_since_last_commit/3600))
49
50 # Sub-hours and sub-minutes
51 DAYS=$((seconds_since_last_commit / 86400))
52 SUB_HOURS=$((HOURS % 24))
53 SUB_MINUTES=$((MINUTES % 60))
54
55 if [[ -n $(git status -s 2> /dev/null) ]]; then
56 if [ "$MINUTES" -gt 30 ]; then
57 COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG"
58 elif [ "$MINUTES" -gt 10 ]; then
59 COLOR="$ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM"
60 else
61 COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT"
62 fi
63 else
64 COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL"
65 fi
66
67 if [ "$HOURS" -gt 24 ]; then
68 echo "($COLOR${DAYS}d${SUB_HOURS}h${SUB_MINUTES}m%{$reset_color%}|"
69 elif [ "$MINUTES" -gt 60 ]; then
70 echo "($COLOR${HOURS}h${SUB_MINUTES}m%{$reset_color%}|"
71 else
72 echo "($COLOR${MINUTES}m%{$reset_color%}|"
73 fi
74 else
75 COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL"
76 echo "($COLOR~|"
77 fi
78 fi
79 }
Something went wrong with that request. Please try again.