]> arthur.barton.de Git - ax-zsh.git/blobdiff - core/50_prompt/50_prompt.zshrc
50_prompt: Implement some common functions as "dummies"
[ax-zsh.git] / core / 50_prompt / 50_prompt.zshrc
index a315e663dc86cfb43f51095ab53a1de6b0e826d0..5869f060826af3d7e90f400355a1636574014ab0 100644 (file)
@@ -1,13 +1,21 @@
 # AX-ZSH: Alex' Modular ZSH Configuration
 # 50_prompt.zshrc: Setup default prompts
 
+# Some dummy functions (used by some OhMyZsh themes, for example) ...
+git_prompt_info(){ true; }
+git_prompt_status(){ true; }
+rvm_prompt_info(){ true; }
+
 # Logname ("user name")
 
 ZSH_THEME_LOGNAME_PROMPT_PREFIX_SPACING=""
-(( $UID == 0 )) \
-       && ZSH_THEME_LOGNAME_PROMPT_PREFIX="%{$fg_no_bold[red]%}" \
-       || ZSH_THEME_LOGNAME_PROMPT_PREFIX=""
-ZSH_THEME_LOGNAME_PROMPT_SUFFIX="%{$reset_color%}"
+if (( $UID == 0 )); then
+       ZSH_THEME_LOGNAME_PROMPT_PREFIX="%{$fg_no_bold[red]%}" \
+       ZSH_THEME_LOGNAME_PROMPT_SUFFIX="%{$reset_color%}"
+else
+       ZSH_THEME_LOGNAME_PROMPT_PREFIX=""
+       ZSH_THEME_LOGNAME_PROMPT_SUFFIX=""
+fi
 ZSH_THEME_LOGNAME_PROMPT_SUFFIX_SPACING="@"
 
 function ax_logname_prompt_root() {
@@ -24,14 +32,14 @@ function ax_logname_prompt_yn() {
        done
 }
 
-ax_logname_prompt_functions=()
+ax_logname_prompt_functions=(ax_logname_prompt_root)
 
 # Hostname
 
 ZSH_THEME_HOSTNAME_PROMPT_PREFIX_SPACING=""
 ZSH_THEME_HOSTNAME_PROMPT_PREFIX=""
-ZSH_THEME_HOSTNAME_PROMPT_SUFFIX="%{$reset_color%}:"
-ZSH_THEME_HOSTNAME_PROMPT_SUFFIX_SPACING=""
+ZSH_THEME_HOSTNAME_PROMPT_SUFFIX=""
+ZSH_THEME_HOSTNAME_PROMPT_SUFFIX_SPACING=":"
 
 function ax_hostname_prompt_root() {
        (( $UID == 0 )) || return 1
@@ -51,15 +59,23 @@ ax_hostname_prompt_functions=()
 
 # VCS
 
+if axzsh_is_utf_terminal; then
+       clean="✔"; dirty="✘"; ahead="→"; behind="←"
+else
+       clean="+"; dirty="x"; ahead=">"; behind="<"
+fi
+
 ZSH_THEME_VCS_PROMPT_PREFIX_SPACING="("
 ZSH_THEME_VCS_PROMPT_PREFIX="%{$fg_no_bold[yellow]%}"
 ZSH_THEME_VCS_PROMPT_SUFFIX="%{$reset_color%}"
 ZSH_THEME_VCS_PROMPT_SUFFIX_SPACING=")"
 
-ZSH_THEME_VCS_PROMPT_CLEAN="%{$fg_no_bold[green]%}✔"
-ZSH_THEME_VCS_PROMPT_DIRTY="%{$fg_no_bold[red]%}✘"
-ZSH_THEME_VCS_PROMPT_AHEAD="%{$fg_no_bold[cyan]%}→"
-ZSH_THEME_VCS_PROMPT_BEHIND="%{$fg_no_bold[blue]%}←"
+ZSH_THEME_VCS_PROMPT_CLEAN=" %{$fg_no_bold[green]%}$clean"
+ZSH_THEME_VCS_PROMPT_DIRTY=" %{$fg_no_bold[red]%}$dirty"
+ZSH_THEME_VCS_PROMPT_AHEAD="%{$fg_no_bold[cyan]%}$ahead"
+ZSH_THEME_VCS_PROMPT_BEHIND="%{$fg_no_bold[blue]%}$behind"
+
+unset clean dirty ahead behind
 
 function ax_vcs_prompt() {
        local func
@@ -95,6 +111,3 @@ function ax_prompt() {
 # Options and defaults
 
 setopt PROMPT_SUBST
-
-export PS1 PS2 PS3 PS4
-export RPS1 RPS2