mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2024-11-25 15:20:08 +00:00
avoid forking subshell to test if user is root
This commit is contained in:
parent
7a9cc19819
commit
8d2b9d10e5
7 changed files with 7 additions and 7 deletions
|
@ -1,4 +1,4 @@
|
||||||
if [ "$(whoami)" = "root" ]; then CARETCOLOR="red"; else CARETCOLOR="blue"; fi
|
if [ $UID -eq 0 ]; then CARETCOLOR="red"; else CARETCOLOR="blue"; fi
|
||||||
|
|
||||||
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
|
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
if [ "$(whoami)" = "root" ]; then NCOLOR="red"; else NCOLOR="yellow"; fi
|
if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="yellow"; fi
|
||||||
|
|
||||||
PROMPT='%{$fg[$NCOLOR]%}%c ➤ %{$reset_color%}'
|
PROMPT='%{$fg[$NCOLOR]%}%c ➤ %{$reset_color%}'
|
||||||
RPROMPT='%{$fg[$NCOLOR]%}%p $(git_prompt_info)%{$reset_color%}'
|
RPROMPT='%{$fg[$NCOLOR]%}%p $(git_prompt_info)%{$reset_color%}'
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
if [ "$(whoami)" = "root" ]; then NCOLOR="red"; else NCOLOR="white"; fi
|
if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="white"; fi
|
||||||
|
|
||||||
PROMPT='%{$fg[$NCOLOR]%}%B%n%b%{$reset_color%}:%{$fg[blue]%}%B%c/%b%{$reset_color%} $(git_prompt_info)%(!.#.$) '
|
PROMPT='%{$fg[$NCOLOR]%}%B%n%b%{$reset_color%}:%{$fg[blue]%}%B%c/%b%{$reset_color%} $(git_prompt_info)%(!.#.$) '
|
||||||
RPROMPT='[%*]'
|
RPROMPT='[%*]'
|
||||||
|
|
|
@ -5,7 +5,7 @@ ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}!"
|
||||||
ZSH_THEME_GIT_PROMPT_CLEAN=""
|
ZSH_THEME_GIT_PROMPT_CLEAN=""
|
||||||
|
|
||||||
function prompt_char {
|
function prompt_char {
|
||||||
if [ "$(whoami)" = "root" ]; then echo "%{$fg[red]%}#%{$reset_color%}"; else echo $; fi
|
if [ $UID -eq 0 ]; then echo "%{$fg[red]%}#%{$reset_color%}"; else echo $; fi
|
||||||
}
|
}
|
||||||
|
|
||||||
PROMPT='%(?, ,%{$fg[red]%}FAIL%{$reset_color%}
|
PROMPT='%(?, ,%{$fg[red]%}FAIL%{$reset_color%}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# ZSH Theme - Preview: http://dl.dropbox.com/u/1552408/Screenshots/2010-04-08-oh-my-zsh.png
|
# ZSH Theme - Preview: http://dl.dropbox.com/u/1552408/Screenshots/2010-04-08-oh-my-zsh.png
|
||||||
|
|
||||||
if [ "$(whoami)" = "root" ]; then NCOLOR="red"; else NCOLOR="green"; fi
|
if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="green"; fi
|
||||||
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
|
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
|
||||||
|
|
||||||
PROMPT='%{$fg[$NCOLOR]%}%n%{$fg[green]%}@%m%{$reset_color%} %~ \
|
PROMPT='%{$fg[$NCOLOR]%}%n%{$fg[green]%}@%m%{$reset_color%} %~ \
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
if [ "$(whoami)" = "root" ]; then NCOLOR="red"; else NCOLOR="green"; fi
|
if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="green"; fi
|
||||||
|
|
||||||
PROMPT='%{$fg[$NCOLOR]%}%B%n%b%{$reset_color%}:%{$fg[blue]%}%B%c/%b%{$reset_color%} $(git_prompt_info)%(!.#.$) '
|
PROMPT='%{$fg[$NCOLOR]%}%B%n%b%{$reset_color%}:%{$fg[blue]%}%B%c/%b%{$reset_color%} $(git_prompt_info)%(!.#.$) '
|
||||||
RPROMPT='[%*]'
|
RPROMPT='[%*]'
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
if [ "$(whoami)" = "root" ]; then NCOLOR="red"; else NCOLOR="green"; fi
|
if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="green"; fi
|
||||||
|
|
||||||
PROMPT='
|
PROMPT='
|
||||||
%{$fg[$NCOLOR]%}%B%n@%m%b%{$reset_color%} %{$fg[white]%}%B${PWD/#$HOME/~}%b%{$reset_color%}
|
%{$fg[$NCOLOR]%}%B%n@%m%b%{$reset_color%} %{$fg[white]%}%B${PWD/#$HOME/~}%b%{$reset_color%}
|
||||||
|
|
Loading…
Reference in a new issue