aboutsummaryrefslogtreecommitdiff
path: root/dotfiles/.config/zsh/.zshrc
diff options
context:
space:
mode:
authorYaroslav de la Peña Smirnov <yps@yaroslavps.com>2023-04-07 20:27:28 +0300
committerYaroslav de la Peña Smirnov <yps@yaroslavps.com>2023-04-12 01:49:18 +0300
commitcc8e82941800a8ebb8a59ab22987a41c5aaa9c3e (patch)
tree90500e549d0951cabce41103be21b850b1b078f9 /dotfiles/.config/zsh/.zshrc
parentef8bf4e980eb149f6ad94b4ce370b02719d41555 (diff)
downloadswayrice-cc8e82941800a8ebb8a59ab22987a41c5aaa9c3e.tar.gz
swayrice-cc8e82941800a8ebb8a59ab22987a41c5aaa9c3e.zip
Use zsh config with root user as well
Diffstat (limited to 'dotfiles/.config/zsh/.zshrc')
-rw-r--r--dotfiles/.config/zsh/.zshrc10
1 files changed, 8 insertions, 2 deletions
diff --git a/dotfiles/.config/zsh/.zshrc b/dotfiles/.config/zsh/.zshrc
index aa1bc69..99ab1d1 100644
--- a/dotfiles/.config/zsh/.zshrc
+++ b/dotfiles/.config/zsh/.zshrc
@@ -6,8 +6,14 @@ precmd_vcs_info() { vcs_info }
precmd_functions+=( precmd_vcs_info )
setopt prompt_subst
-PROMPT=$'\n''%{%}%B%~ ${reset_color}%F{yellow}${vcs_info_msg_0_}%f'$'\n''%F{green}→%f '
-RPROMPT='%{%} %n%f@%F{red}%m%f'
+if [ "$USER" = "root" ]; then
+ # Make it so that we display root's user@host on the left and colored red so
+ # that it is quite clear that we are under root.
+ PROMPT=$'\n''%{%}%B%~ ${reset_color}%F{yellow}${vcs_info_msg_0_}%f'$'\n''%F{red}%n%f@%F{red}%m%f %F{green}→%f '
+else
+ PROMPT=$'\n''%{%}%B%~ ${reset_color}%F{yellow}${vcs_info_msg_0_}%f'$'\n''%F{green}→%f '
+ RPROMPT='%{%} %n%f@%F{red}%m%f'
+fi
zstyle ':vcs_info:git:*' formats ' %b'
# Basic auto/tab complete: