Skip to content

Instantly share code, notes, and snippets.

@andrewodri
Last active August 29, 2024 18:46
Show Gist options
  • Save andrewodri/be2b703f9ef5c2a1fed0cfd56af38ee9 to your computer and use it in GitHub Desktop.
Save andrewodri/be2b703f9ef5c2a1fed0cfd56af38ee9 to your computer and use it in GitHub Desktop.
Oh My Zsh theme with Git/AWS/Kubernetes
local return_code="%(?..%F{001}%? ↵%f)"
local user_host="%(!.%F{001}.%F{002})%n@%m%f "
local user_symbol="%#"
local current_dir="%F{093}%~ %f"
local vcs_branch='$(git_prompt_info)$(hg_prompt_info)'
if [[ "${plugins[@]}" =~ 'kube-ps1' ]]; then
local kube_prompt='$(kube_ps1)'
else
local kube_prompt=''
fi
if [[ "${plugins[@]}" =~ 'aws' ]]; then
local aws_prompt='$(aws_prompt_info)'
else
local aws_prompt=''
fi
PROMPT="╭─${user_host}${current_dir}${vcs_branch}${aws_prompt}${kube_prompt}
╰─%B${user_symbol}%b "
RPROMPT="%B${return_code}%b"
ZSH_THEME_GIT_PROMPT_PREFIX="%F{196}git(%F{202}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%F{196}) %f"
ZSH_THEME_GIT_PROMPT_DIRTY="%F{002} ●"
ZSH_THEME_GIT_PROMPT_CLEAN=""
ZSH_THEME_HG_PROMPT_PREFIX="$ZSH_THEME_GIT_PROMPT_PREFIX"
ZSH_THEME_HG_PROMPT_SUFFIX="$ZSH_THEME_GIT_PROMPT_SUFFIX"
ZSH_THEME_HG_PROMPT_DIRTY="$ZSH_THEME_GIT_PROMPT_DIRTY"
ZSH_THEME_HG_PROMPT_CLEAN="$ZSH_THEME_GIT_PROMPT_CLEAN"
SHOW_AWS_PROMPT=false
ZSH_THEME_AWS_PROFILE_PREFIX="%F{003}aws(%F{011}"
ZSH_THEME_AWS_PROFILE_SUFFIX="%F{003}) %f"
ZSH_THEME_AWS_REGION_PREFIX="%F{003}region(%F{011}"
ZSH_THEME_AWS_REGION_SUFFIX="%F{003}) %f"
ZSH_THEME_AWS_DIVIDER=""
KUBE_PS1_SYMBOL_ENABLE=false
KUBE_PS1_PREFIX="%F{027}kube(%F{033}"
KUBE_PS1_SUFFIX="%F{027}) %f"
KUBE_PS1_CTX_COLOR="33"
KUBE_PS1_NS_COLOR="33"
@andrewodri
Copy link
Author

Copied from https://stackoverflow.com/a/68797795/574904

  • %F(%f) starts(stops) foreground color - I've used 256COLOR values but you could also use hex for example, I've used normal green %F{034} but %F{#00aa00} works too
  • %B(%b) starts(stops) bold
  • %n $USERNAME
  • %m short machine name
  • %~ logged in/working directory with ~ if in home directory
  • %# display % if normal user or # if su

Copied from https://gist.github.com/JBlond/2fea43a3049b38287e5e9cefc87b2124?permalink_comment_id=4481079#gistcomment-4481079

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment