69507c9518f7c7889d8f47ec8e67bfda02405817
- Author
- Marc Cornellà <marc.cornella@live.com>
- Committer
- GitHub <noreply@github.com>
- Date
Message
Diff
This diff is truncated to protect this page.
1diff --git a/themes/adben.zsh-theme b/themes/adben.zsh-theme
2index 7321df72434c372d39bb1f97434b202ca32f2ef2..ebdec7c8275db4246fed2d192fbbe11f6c207e99 100644
3--- a/themes/adben.zsh-theme
4+++ b/themes/adben.zsh-theme
5@@ -29,11 +29,13 @@
6 # # This theme's look and feel is based on the Aaron Toponce's zsh theme, more info:
7 # # https://pthree.org/2008/11/23/727/
8 # # enjoy!
9+
10 ########## COLOR ###########
11 for COLOR in CYAN WHITE YELLOW MAGENTA BLACK BLUE RED DEFAULT GREEN GREY; do
12- eval PR_$COLOR='%{$fg[${(L)COLOR}]%}'
13- eval PR_BRIGHT_$COLOR='%{$fg_bold[${(L)COLOR}]%}'
14+ eval PR_$COLOR='%{$fg[${(L)COLOR}]%}'
15+ eval PR_BRIGHT_$COLOR='%{$fg_bold[${(L)COLOR}]%}'
16 done
17+
18 PR_RESET="%{$reset_color%}"
19 RED_START="${PR_RESET}${PR_GREY}<${PR_RESET}${PR_RED}<${PR_BRIGHT_RED}<${PR_RESET} "
20 RED_END="${PR_RESET}${PR_BRIGHT_RED}>${PR_RESET}${PR_RED}>${PR_GREY}>${PR_RESET} "
21@@ -44,14 +46,14 @@ DIVISION="${PR_RESET}${PR_RED} < ${PR_RESET}"
22 VCS_DIRTY_COLOR="${PR_RESET}${PR_YELLOW}"
23 VCS_CLEAN_COLOR="${PR_RESET}${PR_GREEN}"
24 VCS_SUFIX_COLOR="${PR_RESET}${PR_RED}› ${PR_RESET}"
25-# ########## COLOR ###########
26-# ########## SVN ###########
27+
28+########## SVN ###########
29 ZSH_THEME_SVN_PROMPT_PREFIX="${PR_RESET}${PR_RED}‹svn:"
30 ZSH_THEME_SVN_PROMPT_SUFFIX=""
31 ZSH_THEME_SVN_PROMPT_DIRTY="${VCS_DIRTY_COLOR} ✘${VCS_SUFIX_COLOR}"
32 ZSH_THEME_SVN_PROMPT_CLEAN="${VCS_CLEAN_COLOR} ✔${VCS_SUFIX_COLOR}"
33-# ########## SVN ###########
34-# ########## GIT ###########
35+
36+########## GIT ###########
37 ZSH_THEME_GIT_PROMPT_PREFIX="${PR_RESET}${PR_RED}‹git:"
38 ZSH_THEME_GIT_PROMPT_SUFFIX=""
39 ZSH_THEME_GIT_PROMPT_DIRTY="${VCS_DIRTY_COLOR} ✘${VCS_SUFIX_COLOR}"
40@@ -62,53 +64,63 @@ ZSH_THEME_GIT_PROMPT_DELETED="${PR_RESET}${PR_YELLOW} ✖${PR_RESET}"
41 ZSH_THEME_GIT_PROMPT_RENAMED="${PR_RESET}${PR_YELLOW} ➜${PR_RESET}"
42 ZSH_THEME_GIT_PROMPT_UNMERGED="${PR_RESET}${PR_YELLOW} ═${PR_RESET}"
43 ZSH_THEME_GIT_PROMPT_UNTRACKED="${PR_RESET}${PR_YELLOW} ✭${PR_RESET}"
44-# ########## GIT ###########
45-function precmd {
46- #gets the fortune
47- ps1_fortune () {
48- #Choose from all databases, regardless of whether they are considered "offensive"
49- fortune -a
50- }
51- #obtains the tip
52- ps1_command_tip () {
53- wget -qO - http://www.commandlinefu.com/commands/random/plaintext | sed 1d | sed '/^$/d'
54- }
55- prompt_header () {
56- if [[ "true" == "$ENABLE_COMMAND_TIP" ]]; then
57- ps1_command_tip
58- else
59- ps1_fortune
60- fi
61- }
62- PROMPT_HEAD="${RED_START}${PR_YELLOW}$(prompt_header)${PR_RESET}"
63- # set a simple variable to show when in screen
64- if [[ -n "${WINDOW}" ]]; then
65- SCREEN=""
66+
67+# Get a fortune quote
68+ps1_fortune() {
69+ (( ${+commands[fortune]} )) && fortune
70+}
71+
72+# Obtain a command tip
73+ps1_command_tip() {
74+ {
75+ if (( ${+commands[wget]} )); then
76+ command wget -qO- https://www.commandlinefu.com/commands/random/plaintext
77+ elif (( ${+commands[curl]} )); then
78+ command curl -fsL https://www.commandlinefu.com/commands/random/plaintext
79 fi
80+ } | sed 1d | sed '/^$/d'
81 }
82
83-# Context: user@directory or just directory
84-prompt_context () {
85- if [[ "$USERNAME" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
86- echo -n "${PR_RESET}${PR_RED}$USERNAME@%m${PR_RESET}${PR_BRIGHT_YELLOW}%~%<<${PR_RESET}"
87+function precmd_adben {
88+ prompt_header() {
89+ if [[ "$ENABLE_COMMAND_TIP" = true ]]; then
90+ ps1_command_tip
91 else
92- echo -n "${PR_RESET}${PR_BRIGHT_YELLOW}%~%<<${PR_RESET}"
93+ ps1_fortune
94 fi
95+ }
96+
97+ PROMPT_HEAD="${RED_START}${PR_YELLOW}$(prompt_header)${PR_RESET}"
98+
99+ # set a simple variable to show when in screen
100+ if [[ -n "${WINDOW}" ]]; then
101+ SCREEN=""
102+ fi
103 }
104