2c56345917624bd94bfc05fe7bdbb2051421d5e7
- Author
- Kasper Kronborg Isager <kasperisager@gmail.com>
- Committer
- Kasper Kronborg Isager <kasperisager@gmail.com>
- Date
Message
Diff
This diff is truncated to protect this page.
1diff --git a/themes/pure.zsh-theme b/themes/pure.zsh-theme
2new file mode 100644
3index 0000000000000000000000000000000000000000..d7ed624e4df00c5465ae49216d8f55f2602e86bd
4--- /dev/null
5+++ b/themes/pure.zsh-theme
6@@ -0,0 +1,128 @@
7+#!/usr/bin/env zsh
8+
9+# ------------------------------------------------------------------------------
10+#
11+# Pure - A minimal and beautiful theme for oh-my-zsh
12+#
13+# Based on the custom Zsh-prompt of the same name by Sindre Sorhus. A huge
14+# thanks goes out to him for designing the fantastic Pure prompt in the first
15+# place! I'd also like to thank Julien Nicoulaud for his "nicoulaj" theme from
16+# which I've borrowed both some ideas and some actual code. You can find out
17+# more about both of these fantastic two people here:
18+#
19+# Sindre Sorhus
20+# Github: https://github.com/sindresorhus
21+# Twitter: https://twitter.com/sindresorhus
22+#
23+# Julien Nicoulaud
24+# Github: https://github.com/nicoulaj
25+# Twitter: https://twitter.com/nicoulaj
26+#
27+# License
28+#
29+# Copyright (c) 2013 Kasper Kronborg Isager
30+#
31+# Permission is hereby granted, free of charge, to any person obtaining a copy
32+# of this software and associated documentation files (the "Software"), to deal
33+# in the Software without restriction, including without limitation the rights
34+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
35+# copies of the Software, and to permit persons to whom the Software is
36+# furnished to do so, subject to the following conditions:
37+#
38+# The above copyright notice and this permission notice shall be included in
39+# all copies or substantial portions of the Software.
40+#
41+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
42+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
43+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
44+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
45+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
46+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
47+# THE SOFTWARE.
48+#
49+# ------------------------------------------------------------------------------
50+
51+# Set required options
52+#
53+setopt prompt_subst
54+
55+# Load required modules
56+#
57+autoload -Uz vcs_info
58+
59+# Set vcs_info parameters
60+#
61+zstyle ':vcs_info:*' enable hg bzr git
62+zstyle ':vcs_info:*:*' unstagedstr '!'
63+zstyle ':vcs_info:*:*' stagedstr '+'
64+zstyle ':vcs_info:*:*' formats "$FX[bold]%r$FX[no-bold]/%S" "%s/%b" "%%u%c"
65+zstyle ':vcs_info:*:*' actionformats "$FX[bold]%r$FX[no-bold]/%S" "%s/%b" "%u%c (%a)"
66+zstyle ':vcs_info:*:*' nvcsformats "%~" "" ""
67+
68+# Fastest possible way to check if repo is dirty
69+#
70+git_dirty() {
71+ # Check if we're in a git repo
72+ command git rev-parse --is-inside-work-tree &>/dev/null || return
73+ # Check if it's dirty
74+ command git diff --quiet --ignore-submodules HEAD &>/dev/null; [ $? -eq 1 ] && echo "*"
75+}
76+
77+# Display information about the current repository
78+#
79+repo_information() {
80+ echo "%F{blue}${vcs_info_msg_0_%%/.} %F{8}$vcs_info_msg_1_`git_dirty` $vcs_info_msg_2_%f"
81+}
82+
83+# Displays the exec time of the last command if set threshold was exceeded
84+#
85+cmd_exec_time() {
86+ local stop=`date +%s`
87+ local start=${cmd_timestamp:-$stop}
88+ let local elapsed=$stop-$start
89+ [ $elapsed -gt 5 ] && echo ${elapsed}s
90+}
91+
92+# Get the intial timestamp for cmd_exec_time
93+#
94+preexec() {
95+ cmd_timestamp=`date +%s`
96+}
97+
98+# Output additional information about paths, repos and exec time
99+#
100+precmd() {
101+ vcs_info # Get version control info before we start outputting stuff
102+ print -P "\n$(repo_information) %F{yellow}$(cmd_exec_time)%f"
103+}
104+
105+# Define prompts