Skip to content

Commit fcebbe5

Browse files
committed
Modified custom theme + updates to zshrc
1 parent 56eba74 commit fcebbe5

File tree

2 files changed

+227
-11
lines changed

2 files changed

+227
-11
lines changed

oh-my-zsh/themes/teoss.zsh-theme

+225
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,225 @@
1+
# vim:ft=zsh ts=2 sw=2 sts=2
2+
#
3+
# agnoster's Theme - https://gist.github.com/3712874
4+
# A Powerline-inspired theme for ZSH
5+
#
6+
# # README
7+
#
8+
# In order for this theme to render correctly, you will need a
9+
# [Powerline-patched font](https://github.com/Lokaltog/powerline-fonts).
10+
# Make sure you have a recent version: the code points that Powerline
11+
# uses changed in 2012, and older versions will display incorrectly,
12+
# in confusing ways.
13+
#
14+
# In addition, I recommend the
15+
# [Solarized theme](https://github.com/altercation/solarized/) and, if you're
16+
# using it on Mac OS X, [iTerm 2](http://www.iterm2.com/) over Terminal.app -
17+
# it has significantly better color fidelity.
18+
#
19+
# # Goals
20+
#
21+
# The aim of this theme is to only show you *relevant* information. Like most
22+
# prompts, it will only show git information when in a git working directory.
23+
# However, it goes a step further: everything from the current user and
24+
# hostname to whether the last call exited with an error to whether background
25+
# jobs are running in this shell will all be displayed automatically when
26+
# appropriate.
27+
28+
### Segment drawing
29+
# A few utility functions to make it easy and re-usable to draw segmented prompts
30+
31+
CURRENT_BG='NONE'
32+
33+
# Special Powerline characters
34+
35+
() {
36+
local LC_ALL="" LC_CTYPE="en_US.UTF-8"
37+
# NOTE: This segment separator character is correct. In 2012, Powerline changed
38+
# the code points they use for their special characters. This is the new code point.
39+
# If this is not working for you, you probably have an old version of the
40+
# Powerline-patched fonts installed. Download and install the new version.
41+
# Do not submit PRs to change this unless you have reviewed the Powerline code point
42+
# history and have new information.
43+
# This is defined using a Unicode escape sequence so it is unambiguously readable, regardless of
44+
# what font the user is viewing this source code in. Do not replace the
45+
# escape sequence with a single literal character.
46+
# Do not change this! Do not make it '\u2b80'; that is the old, wrong code point.
47+
SEGMENT_SEPARATOR=$'\ue0b0'
48+
}
49+
50+
# Begin a segment
51+
# Takes two arguments, background and foreground. Both can be omitted,
52+
# rendering default background/foreground.
53+
prompt_segment() {
54+
local bg fg
55+
[[ -n $1 ]] && bg="%K{$1}" || bg="%k"
56+
[[ -n $2 ]] && fg="%F{$2}" || fg="%f"
57+
if [[ $CURRENT_BG != 'NONE' && $1 != $CURRENT_BG ]]; then
58+
echo -n " %{$bg%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR%{$fg%} "
59+
else
60+
echo -n "%{$bg%}%{$fg%} "
61+
fi
62+
CURRENT_BG=$1
63+
[[ -n $3 ]] && echo -n $3
64+
}
65+
66+
# End the prompt, closing any open segments
67+
prompt_end() {
68+
if [[ -n $CURRENT_BG ]]; then
69+
echo -n " %{%k%F{$CURRENT_BG}%}$SEGMENT_SEPARATOR"
70+
else
71+
echo -n "%{%k%}"
72+
fi
73+
echo -n "%{%f%}"
74+
CURRENT_BG=''
75+
}
76+
77+
### Prompt components
78+
# Each component will draw itself, and hide itself if no information needs to be shown
79+
80+
# Context: user@hostname (who am I and where am I)
81+
prompt_context() {
82+
if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
83+
prompt_segment black default "%(!.%{%F{yellow}%}.)$USER@%m"
84+
fi
85+
}
86+
87+
# Git: branch/detached head, dirty status
88+
prompt_git() {
89+
(( $+commands[git] )) || return
90+
local PL_BRANCH_CHAR
91+
() {
92+
local LC_ALL="" LC_CTYPE="en_US.UTF-8"
93+
PL_BRANCH_CHAR=$'\ue0a0' #
94+
}
95+
local ref dirty mode repo_path
96+
repo_path=$(git rev-parse --git-dir 2>/dev/null)
97+
98+
if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then
99+
dirty=$(parse_git_dirty)
100+
ref=$(git symbolic-ref HEAD 2> /dev/null) || ref="$(git rev-parse --short HEAD 2> /dev/null)"
101+
if [[ -n $dirty ]]; then
102+
prompt_segment yellow black
103+
else
104+
prompt_segment green black
105+
fi
106+
107+
if [[ -e "${repo_path}/BISECT_LOG" ]]; then
108+
mode=" <B>"
109+
elif [[ -e "${repo_path}/MERGE_HEAD" ]]; then
110+
mode=" >M<"
111+
elif [[ -e "${repo_path}/rebase" || -e "${repo_path}/rebase-apply" || -e "${repo_path}/rebase-merge" || -e "${repo_path}/../.dotest" ]]; then
112+
mode=" >R>"
113+
fi
114+
115+
setopt promptsubst
116+
autoload -Uz vcs_info
117+
118+
zstyle ':vcs_info:*' enable git
119+
zstyle ':vcs_info:*' get-revision true
120+
zstyle ':vcs_info:*' check-for-changes true
121+
zstyle ':vcs_info:*' stagedstr ''
122+
zstyle ':vcs_info:*' unstagedstr ''
123+
zstyle ':vcs_info:*' formats ' %u%c'
124+
zstyle ':vcs_info:*' actionformats ' %u%c'
125+
vcs_info
126+
echo -n "${ref/refs\/heads\//$PL_BRANCH_CHAR }${vcs_info_msg_0_%% }${mode}"
127+
fi
128+
}
129+
130+
prompt_bzr() {
131+
(( $+commands[bzr] )) || return
132+
if (bzr status >/dev/null 2>&1); then
133+
status_mod=`bzr status | head -n1 | grep "modified" | wc -m`
134+
status_all=`bzr status | head -n1 | wc -m`
135+
revision=`bzr log | head -n2 | tail -n1 | sed 's/^revno: //'`
136+
if [[ $status_mod -gt 0 ]] ; then
137+
prompt_segment yellow black
138+
echo -n "bzr@"$revision ""
139+
else
140+
if [[ $status_all -gt 0 ]] ; then
141+
prompt_segment yellow black
142+
echo -n "bzr@"$revision
143+
144+
else
145+
prompt_segment green black
146+
echo -n "bzr@"$revision
147+
fi
148+
fi
149+
fi
150+
}
151+
152+
prompt_hg() {
153+
(( $+commands[hg] )) || return
154+
local rev status
155+
if $(hg id >/dev/null 2>&1); then
156+
if $(hg prompt >/dev/null 2>&1); then
157+
if [[ $(hg prompt "{status|unknown}") = "?" ]]; then
158+
# if files are not added
159+
prompt_segment red white
160+
st='±'
161+
elif [[ -n $(hg prompt "{status|modified}") ]]; then
162+
# if any modification
163+
prompt_segment yellow black
164+
st='±'
165+
else
166+
# if working copy is clean
167+
prompt_segment green black
168+
fi
169+
echo -n $(hg prompt "☿ {rev}@{branch}") $st
170+
else
171+
st=""
172+
rev=$(hg id -n 2>/dev/null | sed 's/[^-0-9]//g')
173+
branch=$(hg id -b 2>/dev/null)
174+
if `hg st | grep -q "^\?"`; then
175+
prompt_segment red black
176+
st='±'
177+
elif `hg st | grep -q "^[MA]"`; then
178+
prompt_segment yellow black
179+
st='±'
180+
else
181+
prompt_segment green black
182+
fi
183+
echo -n "$rev@$branch" $st
184+
fi
185+
fi
186+
}
187+
188+
# Dir: current working directory
189+
prompt_dir() {
190+
prompt_segment blue black '%~'
191+
}
192+
193+
# Virtualenv: current working virtualenv
194+
prompt_virtualenv() {
195+
local virtualenv_path="$VIRTUAL_ENV"
196+
if [[ -n $virtualenv_path && -n $VIRTUAL_ENV_DISABLE_PROMPT ]]; then
197+
prompt_segment blue black "(`basename $virtualenv_path`)"
198+
fi
199+
}
200+
201+
# Status:
202+
# - was there an error
203+
# - am I root
204+
# - are there background jobs?
205+
prompt_status() {
206+
local symbols
207+
symbols=()
208+
[[ $RETVAL -ne 0 ]] && symbols+="%{%F{red}%}✘"
209+
[[ $UID -eq 0 ]] && symbols+="%{%F{yellow}%}⚡"
210+
[[ $(jobs -l | wc -l) -gt 0 ]] && symbols+="%{%F{cyan}%}⚙"
211+
212+
[[ -n "$symbols" ]] && prompt_segment black default "$symbols"
213+
}
214+
215+
## Main prompt
216+
build_prompt() {
217+
RETVAL=$?
218+
prompt_status
219+
prompt_virtualenv
220+
prompt_context
221+
prompt_dir
222+
prompt_end
223+
}
224+
225+
PROMPT='%{%f%b%k%}$(build_prompt) '

zshrc

+2-11
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
# Path to your oh-my-zsh installation.
22
export ZSH=/home/vagrant/.oh-my-zsh
33
export ZSH_UTILS=/home/vagrant/.zsh-utils
4+
export ZSH_CUSTOM=/home/vagrant/.zsh-utils/custom
45

56
# Set name of the theme to load.
67
# Look in ~/.oh-my-zsh/themes/
78
# Optionally, if you set this to "random", it'll load a random theme each
89
# time that oh-my-zsh is loaded.
9-
ZSH_THEME="agnoster"
10+
ZSH_THEME="teoss"
1011

1112
# Uncomment the following line to use case-sensitive completion.
1213
# CASE_SENSITIVE="true"
@@ -101,16 +102,6 @@ alias csfix="bin/idx code-standard:fix"
101102
alias xdoff="sudo php5dismod xdebug"
102103
alias xdon="sudo php5enmod xdebug"
103104

104-
# The next line updates PATH for the Google Cloud SDK.
105-
if [ -f /home/vagrant/google-cloud-sdk/path.zsh.inc ]; then
106-
source '/home/vagrant/google-cloud-sdk/path.zsh.inc'
107-
fi
108-
109-
# The next line enables shell command completion for gcloud.
110-
if [ -f /home/vagrant/google-cloud-sdk/completion.zsh.inc ]; then
111-
source '/home/vagrant/google-cloud-sdk/completion.zsh.inc'
112-
fi
113-
114105
if [ -f /home/vagrant/.zshrc.local ]; then
115106
source /home/vagrant/.zshrc.local
116107
fi

0 commit comments

Comments
 (0)