c3c355a88a15d45f87b89f69cf3c2b0245481e60
- Author
- Robby Russell <robby@planetargon.com>
- Committer
- Robby Russell <robby@planetargon.com>
- Date
Message
Diff
This diff is truncated to protect this page.
1diff --git a/plugins/git/git.plugin.zsh b/plugins/git/git.plugin.zsh
2index 15f901f86ce68ca2cd76589a2b0ebd19967e008d..d6b2632b3188af092315a484e0972e211bba2e94 100644
3--- a/plugins/git/git.plugin.zsh
4+++ b/plugins/git/git.plugin.zsh
5@@ -3,6 +3,8 @@ alias g='git'
6 compdef g=git
7 alias gst='git status'
8 compdef _git gst=git-status
9+alias gd='git diff'
10+compdef _git gd=git-diff
11 alias gl='git pull'
12 compdef _git gl=git-pull
13 alias gup='git pull --rebase'
14diff --git a/themes/avit.zsh-theme b/themes/avit.zsh-theme
15new file mode 100644
16index 0000000000000000000000000000000000000000..51f5e375ad4b459d2b853a7532f51a12919b0520
17--- /dev/null
18+++ b/themes/avit.zsh-theme
19@@ -0,0 +1,120 @@
20+#
21+# Author:: Andrew Vit (<andrew@avit.ca>)
22+#
23+# AVIT ZSH Theme
24+#
25+# Copyright 2011, Andrew Vit
26+#
27+# Licensed under the Apache License, Version 2.0 (the "License");
28+# you may not use this file except in compliance with the License.
29+# You may obtain a copy of the License at
30+#
31+# http://www.apache.org/licenses/LICENSE-2.0
32+#
33+# Unless required by applicable law or agreed to in writing, software
34+# distributed under the License is distributed on an "AS IS" BASIS,
35+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
36+# See the License for the specific language governing permissions and
37+# limitations under the License.
38+#
39+
40+PROMPT='
41+$(_user_host)${_current_dir} $(git_prompt_info) $(_ruby_version)
42+▶ '
43+
44+PROMPT2='%{$fg[grey]%}◀%{$reset_color%} '
45+
46+RPROMPT='$(_vi_status)%{$(echotc UP 1)%}$(_git_time_since_commit) $(git_prompt_status) ${_return_status}%{$(echotc DO 1)%}'
47+
48+local _current_dir="%{$fg[blue]%}%3~%{$reset_color%} "
49+local _return_status="%{$fg[red]%}%(?..⍉)%{$reset_color%}"
50+local _hist_no="%{$fg[grey]%}%h%{$reset_color%}"
51+
52+function _user_host() {
53+ if [[ -n $SSH_CONNECTION ]]; then
54+ me="%n@%m"
55+ elif [[ $LOGNAME != $USER ]]; then
56+ me="%n"
57+ fi
58+ if [[ -n $me ]]; then
59+ echo "%{$fg[cyan]%}$me%{$reset_color%}:"
60+ fi
61+}
62+
63+function _vi_status() {
64+ if {echo $fpath | grep -q "plugins/vi-mode"}; then
65+ echo "$(vi_mode_prompt_info)"
66+ fi
67+}
68+
69+function _ruby_version() {
70+ if {echo $fpath | grep -q "plugins/rvm"}; then
71+ echo "%{$fg[grey]%}$(rvm_prompt_info)%{$reset_color%}"
72+ fi
73+}
74+
75+# Determine the time since last commit. If branch is clean,
76+# use a neutral color, otherwise colors will vary according to time.
77+function _git_time_since_commit() {
78+ if git rev-parse --git-dir > /dev/null 2>&1; then
79+ # Only proceed if there is actually a commit.
80+ if [[ $(git log 2>&1 > /dev/null | grep -c "^fatal: bad default revision") == 0 ]]; then
81+ # Get the last commit.
82+ last_commit=$(git log --pretty=format:'%at' -1 2> /dev/null)
83+ now=$(date +%s)
84+ seconds_since_last_commit=$((now-last_commit))
85+
86+ # Totals
87+ minutes=$((seconds_since_last_commit / 60))
88+ hours=$((seconds_since_last_commit/3600))
89+
90+ # Sub-hours and sub-minutes
91+ days=$((seconds_since_last_commit / 86400))
92+ sub_hours=$((hours % 24))
93+ sub_minutes=$((minutes % 60))
94+
95+ if [ $hours -gt 24 ]; then
96+ commit_age="${days}d"
97+ elif [ $minutes -gt 60 ]; then
98+ commit_age="${sub_hours}h${sub_minutes}m"
99+ else
100+ commit_age="${minutes}m"
101+ fi
102+
103+ color=$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL
104+ echo "$color$commit_age%{$reset_color%}"
105+ fi
106+ fi
107+}
108+
109+if [[ $USER == "root" ]]; then
110+ CARETCOLOR="red"
111+else
112+ CARETCOLOR="white"
113+fi
114+
115+MODE_INDICATOR="%{$fg_bold[yellow]%}❮%{$reset_color%}%{$fg[yellow]%}❮❮%{$reset_color%}"
116+
117+ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}"
118+ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"