Skip to content

Instantly share code, notes, and snippets.

@zahidhassanshaikot
Last active September 4, 2023 10:10
Show Gist options
  • Select an option

  • Save zahidhassanshaikot/afa6325fda4004668f862e4f71874c17 to your computer and use it in GitHub Desktop.

Select an option

Save zahidhassanshaikot/afa6325fda4004668f862e4f71874c17 to your computer and use it in GitHub Desktop.
Adding and customizing your own themes pretty much works the same as with plugins. Themes are located in a themes folder and must end with .zsh-theme. The basename of the file is the name of the theme. $ZSH_CUSTOM └── themes └── my_awesome_theme.zsh-theme Then edit your .zshrc to use that theme. ZSH_THEME="my_awesome_theme" Remember that customi…
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
local user_host="%B%(!.%{$fg[red]%}.%{$fg[green]%})%n@%m%{$reset_color%} "
local user_symbol='%(!.#.$)'
local current_dir="%B%{$fg[blue]%}%~ %{$reset_color%}"
local vcs_branch='$(git_prompt_info)$(hg_prompt_info)'
local rvm_ruby='$(ruby_prompt_info)'
local venv_prompt='$(virtualenv_prompt_info)'
ZSH_THEME_RVM_PROMPT_OPTIONS="i v g"
PROMPT="%{$FG[220]%}╭─←•─────━━─────━━◉%{$reset_color%} %F{white}%D{%a,%b-%d} %D{%L:%M:%S} %D{%p}%f %{$FG[220]%}◉ ━━─────━━─────←•
┃─%{$reset_color%}${user_host}${current_dir}${rvm_ruby}${vcs_branch}${venv_prompt}
%{$FG[220]%}╰─➤%{$reset_color%} %F{green}%B${user_symbol}%b %{$reset_color%}"
RPROMPT="%B${return_code}%b"
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹"
ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}●%{$fg[yellow]%}"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[yellow]%}"
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"
ZSH_THEME_RUBY_PROMPT_PREFIX="%{$fg[red]%}‹"
ZSH_THEME_RUBY_PROMPT_SUFFIX="› %{$reset_color%}"
ZSH_THEME_VIRTUAL_ENV_PROMPT_PREFIX="%{$fg[green]%}‹"
ZSH_THEME_VIRTUAL_ENV_PROMPT_SUFFIX="› %{$reset_color%}"
ZSH_THEME_VIRTUALENV_PREFIX="$ZSH_THEME_VIRTUAL_ENV_PROMPT_PREFIX"
ZSH_THEME_VIRTUALENV_SUFFIX="$ZSH_THEME_VIRTUAL_ENV_PROMPT_SUFFIX"
@zahidhassanshaikot
Copy link
Author

Adding and customizing your own themes pretty much works the same as with plugins.

Themes are located in a themes folder and must end with .zsh-theme. The basename of the file is the name of the theme.

$ZSH_CUSTOM
└── themes
└── my_awesome_theme.zsh-theme
Then edit your .zshrc to use that theme.

ZSH_THEME="my_awesome_theme"
Remember that customizations always take precedence over built-ins. If you happen to enjoy a particular theme that comes packaged with Oh My Zsh, but would like to change just a little detail inside of it – let's say you love the agnoster theme, it will be the easiest to copy the agnoster.zsh-theme file to your custom/themes directory and customize it.

If you don't change its filename, your .zshrc file can stay the same: ZSH_THEME="agnoster" will be perfect and still take your changes into account. You might also want to consider this before filing a new issue or pull request that just changes a trivial detail inside of a built-in theme.

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