Skip to content

Instantly share code, notes, and snippets.

@toruticas
Last active October 7, 2023 08:24
Show Gist options
  • Save toruticas/5ca62ea757c0b17dd7f96451de2fcda5 to your computer and use it in GitHub Desktop.
Save toruticas/5ca62ea757c0b17dd7f96451de2fcda5 to your computer and use it in GitHub Desktop.
.oh-my-zsh/themes/toruticas.zsh-theme
# Based on gnzhtheme
setopt prompt_subst
() {
local PR_USER PR_USER_OP PR_PROMPT PR_HOST
# Check the UID
if [[ $UID -ne 0 ]]; then # normal user
PR_USER='%F{cyan}%n%f'
PR_USER_OP='%F{green}%#%f'
PR_PROMPT='%f➤ %f'
else # root
PR_USER='%F{red}%n%f'
PR_USER_OP='%F{red}%#%f'
PR_PROMPT='%F{red}➤ %f'
fi
# Check if we are on SSH or not
if [[ -n "$SSH_CLIENT" || -n "$SSH2_CLIENT" ]]; then
PR_HOST='%F{red}%M%f' # SSH
else
PR_HOST='%F{green}%M%f' # no SSH
fi
local time='%{%F{blue}%}[%b%{$fg[white]%}'%D{"%Y-%m-%d %I:%M:%S"}%b$'%{%F{blue}%}]%F{white}'
local return_code="%(?..%F{red}%? ↵%f)"
local user_host="%F{cyan}@${PR_USER}"
local current_dir="%B%F{blue}%~%f%b"
local git_branch='$(git_prompt_info)'
PROMPT="╭─${user_host} ${current_dir} \$(nvm_prompt_info) ${git_branch}${time}
╰─$PR_PROMPT "
RPROMPT="${return_code}"
ZSH_THEME_GIT_PROMPT_PREFIX="%F{yellow}‹"
ZSH_THEME_GIT_PROMPT_SUFFIX="› %f"
ZSH_THEME_NVM_PROMPT_PREFIX="%F{green}‹node "
ZSH_THEME_NVM_PROMPT_SUFFIX="›%f"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment