summaryrefslogtreecommitdiff
path: root/themes
diff options
context:
space:
mode:
Diffstat (limited to 'themes')
-rw-r--r--themes/adben.zsh-theme102
-rw-r--r--themes/agnoster.zsh-theme2
-rw-r--r--themes/avit.zsh-theme2
-rw-r--r--themes/flazz.zsh-theme2
-rw-r--r--themes/obraun.zsh-theme2
-rw-r--r--themes/re5et.zsh-theme2
-rw-r--r--themes/sunrise.zsh-theme2
7 files changed, 63 insertions, 51 deletions
diff --git a/themes/adben.zsh-theme b/themes/adben.zsh-theme
index b9ac77d00..ebdec7c82 100644
--- a/themes/adben.zsh-theme
+++ b/themes/adben.zsh-theme
@@ -29,11 +29,13 @@
# # This theme's look and feel is based on the Aaron Toponce's zsh theme, more info:
# # https://pthree.org/2008/11/23/727/
# # enjoy!
+
########## COLOR ###########
for COLOR in CYAN WHITE YELLOW MAGENTA BLACK BLUE RED DEFAULT GREEN GREY; do
- eval PR_$COLOR='%{$fg[${(L)COLOR}]%}'
- eval PR_BRIGHT_$COLOR='%{$fg_bold[${(L)COLOR}]%}'
+ eval PR_$COLOR='%{$fg[${(L)COLOR}]%}'
+ eval PR_BRIGHT_$COLOR='%{$fg_bold[${(L)COLOR}]%}'
done
+
PR_RESET="%{$reset_color%}"
RED_START="${PR_RESET}${PR_GREY}<${PR_RESET}${PR_RED}<${PR_BRIGHT_RED}<${PR_RESET} "
RED_END="${PR_RESET}${PR_BRIGHT_RED}>${PR_RESET}${PR_RED}>${PR_GREY}>${PR_RESET} "
@@ -44,14 +46,14 @@ DIVISION="${PR_RESET}${PR_RED} < ${PR_RESET}"
VCS_DIRTY_COLOR="${PR_RESET}${PR_YELLOW}"
VCS_CLEAN_COLOR="${PR_RESET}${PR_GREEN}"
VCS_SUFIX_COLOR="${PR_RESET}${PR_RED}› ${PR_RESET}"
-# ########## COLOR ###########
-# ########## SVN ###########
+
+########## SVN ###########
ZSH_THEME_SVN_PROMPT_PREFIX="${PR_RESET}${PR_RED}‹svn:"
ZSH_THEME_SVN_PROMPT_SUFFIX=""
ZSH_THEME_SVN_PROMPT_DIRTY="${VCS_DIRTY_COLOR} ✘${VCS_SUFIX_COLOR}"
ZSH_THEME_SVN_PROMPT_CLEAN="${VCS_CLEAN_COLOR} ✔${VCS_SUFIX_COLOR}"
-# ########## SVN ###########
-# ########## GIT ###########
+
+########## GIT ###########
ZSH_THEME_GIT_PROMPT_PREFIX="${PR_RESET}${PR_RED}‹git:"
ZSH_THEME_GIT_PROMPT_SUFFIX=""
ZSH_THEME_GIT_PROMPT_DIRTY="${VCS_DIRTY_COLOR} ✘${VCS_SUFIX_COLOR}"
@@ -62,53 +64,63 @@ ZSH_THEME_GIT_PROMPT_DELETED="${PR_RESET}${PR_YELLOW} ✖${PR_RESET}"
ZSH_THEME_GIT_PROMPT_RENAMED="${PR_RESET}${PR_YELLOW} ➜${PR_RESET}"
ZSH_THEME_GIT_PROMPT_UNMERGED="${PR_RESET}${PR_YELLOW} ═${PR_RESET}"
ZSH_THEME_GIT_PROMPT_UNTRACKED="${PR_RESET}${PR_YELLOW} ✭${PR_RESET}"
-# ########## GIT ###########
-function precmd {
- #gets the fortune
- ps1_fortune () {
- #Choose from all databases, regardless of whether they are considered "offensive"
- fortune -a
- }
- #obtains the tip
- ps1_command_tip () {
- wget -qO - http://www.commandlinefu.com/commands/random/plaintext | sed 1d | sed '/^$/d'
- }
- prompt_header () {
- if [[ "true" == "$ENABLE_COMMAND_TIP" ]]; then
- ps1_command_tip
- else
- ps1_fortune
- fi
- }
- PROMPT_HEAD="${RED_START}${PR_YELLOW}$(prompt_header)${PR_RESET}"
- # set a simple variable to show when in screen
- if [[ -n "${WINDOW}" ]]; then
- SCREEN=""
+
+# Get a fortune quote
+ps1_fortune() {
+ (( ${+commands[fortune]} )) && fortune
+}
+
+# Obtain a command tip
+ps1_command_tip() {
+ {
+ if (( ${+commands[wget]} )); then
+ command wget -qO- https://www.commandlinefu.com/commands/random/plaintext
+ elif (( ${+commands[curl]} )); then
+ command curl -fsL https://www.commandlinefu.com/commands/random/plaintext
fi
+ } | sed 1d | sed '/^$/d'
}
-# Context: user@directory or just directory
-prompt_context () {
- if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
- echo -n "${PR_RESET}${PR_RED}$USER@%m${PR_RESET}${PR_BRIGHT_YELLOW}%~%<<${PR_RESET}"
+function precmd_adben {
+ prompt_header() {
+ if [[ "$ENABLE_COMMAND_TIP" = true ]]; then
+ ps1_command_tip
else
- echo -n "${PR_RESET}${PR_BRIGHT_YELLOW}%~%<<${PR_RESET}"
+ ps1_fortune
fi
+ }
+
+ PROMPT_HEAD="${RED_START}${PR_YELLOW}$(prompt_header)${PR_RESET}"
+
+ # set a simple variable to show when in screen
+ if [[ -n "${WINDOW}" ]]; then
+ SCREEN=""
+ fi
}
-set_prompt () {
- # required for the prompt
- setopt prompt_subst
- autoload zsh/terminfo
+# Context: user@directory or just directory
+prompt_context() {
+ if [[ "$USERNAME" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
+ echo -n "${PR_RESET}${PR_RED}$USERNAME@%m${PR_RESET}${PR_BRIGHT_YELLOW}%~%<<${PR_RESET}"
+ else
+ echo -n "${PR_RESET}${PR_BRIGHT_YELLOW}%~%<<${PR_RESET}"
+ fi
+}
- # ######### PROMPT #########
- PROMPT='${PROMPT_HEAD}
+########## SETUP ###########
+
+# Required for the prompt
+setopt prompt_subst
+autoload zsh/terminfo
+
+# Prompt
+PROMPT='${PROMPT_HEAD}
${RED_START}$(prompt_context)
${GREEN_START_P1}'
- RPROMPT='${PR_RESET}$(git_prompt_info)$(svn_prompt_info)${PR_YELLOW}%D{%R.%S %a %b %d %Y} ${GREEN_END}${PR_RESET}'
- # Matching continuation prompt
- PROMPT2='${GREEN_BASE_START}${PR_RESET} %_ ${GREEN_BASE_START}${PR_RESET} '
- # ######### PROMPT #########
-}
+RPROMPT='${PR_RESET}$(git_prompt_info)$(svn_prompt_info)${PR_YELLOW}%D{%R.%S %a %b %d %Y} ${GREEN_END}${PR_RESET}'
+# Matching continuation prompt
+PROMPT2='${GREEN_BASE_START}${PR_RESET} %_ ${GREEN_BASE_START}${PR_RESET} '
-set_prompt
+# Prompt head
+autoload -Uz add-zsh-hook
+add-zsh-hook precmd precmd_adben
diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme
index 90e603ccc..4949aa83a 100644
--- a/themes/agnoster.zsh-theme
+++ b/themes/agnoster.zsh-theme
@@ -88,7 +88,7 @@ prompt_end() {
# Context: user@hostname (who am I and where am I)
prompt_context() {
- if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
+ if [[ "$USERNAME" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
prompt_segment black default "%(!.%{%F{yellow}%}.)%n@%m"
fi
}
diff --git a/themes/avit.zsh-theme b/themes/avit.zsh-theme
index 921ed99d3..1e20d8f9f 100644
--- a/themes/avit.zsh-theme
+++ b/themes/avit.zsh-theme
@@ -17,7 +17,7 @@ function _user_host() {
local me
if [[ -n $SSH_CONNECTION ]]; then
me="%n@%m"
- elif [[ $LOGNAME != $USER ]]; then
+ elif [[ $LOGNAME != $USERNAME ]]; then
me="%n"
fi
if [[ -n $me ]]; then
diff --git a/themes/flazz.zsh-theme b/themes/flazz.zsh-theme
index c0a7fb5d0..e21b52ef5 100644
--- a/themes/flazz.zsh-theme
+++ b/themes/flazz.zsh-theme
@@ -1,4 +1,4 @@
-if [ "$USER" = "root" ]
+if [ "$USERNAME" = "root" ]
then CARETCOLOR="red"
else CARETCOLOR="blue"
fi
diff --git a/themes/obraun.zsh-theme b/themes/obraun.zsh-theme
index 7af44056f..cc2769e4b 100644
--- a/themes/obraun.zsh-theme
+++ b/themes/obraun.zsh-theme
@@ -1,4 +1,4 @@
-if [ "$USER" = "root" ]; then CARETCOLOR="red"; else CARETCOLOR="blue"; fi
+if [ "$USERNAME" = "root" ]; then CARETCOLOR="red"; else CARETCOLOR="blue"; fi
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
diff --git a/themes/re5et.zsh-theme b/themes/re5et.zsh-theme
index 95af1e2ee..bdf342f49 100644
--- a/themes/re5et.zsh-theme
+++ b/themes/re5et.zsh-theme
@@ -1,4 +1,4 @@
-if [ "$USER" = "root" ]; then CARETCOLOR="red"; else CARETCOLOR="magenta"; fi
+if [ "$USERNAME" = "root" ]; then CARETCOLOR="red"; else CARETCOLOR="magenta"; fi
local return_code="%(?..%{$fg_bold[red]%}:( %?%{$reset_color%})"
diff --git a/themes/sunrise.zsh-theme b/themes/sunrise.zsh-theme
index 2111576c3..11f6af127 100644
--- a/themes/sunrise.zsh-theme
+++ b/themes/sunrise.zsh-theme
@@ -9,7 +9,7 @@ Y=$fg_no_bold[yellow]
B=$fg_no_bold[blue]
RESET=$reset_color
-if [ "$USER" = "root" ]; then
+if [ "$USERNAME" = "root" ]; then
PROMPTCOLOR="%{$R%}" PROMPTPREFIX="-!-";
else
PROMPTCOLOR="" PROMPTPREFIX="---";