Skip to content

Instantly share code, notes, and snippets.

@uysalserkan
Created September 6, 2022 07:32
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save uysalserkan/0de657d25d05225af73bbe8d31b60733 to your computer and use it in GitHub Desktop.
Save uysalserkan/0de657d25d05225af73bbe8d31b60733 to your computer and use it in GitHub Desktop.
Custom and basic zsh theme
# It's created by Serkan UYSAL; github:uysalserkan
# Set up git variables
autoload -Uz vcs_info
zstyle ':vcs_info:*' check-for-changes true
zstyle ':vcs_info:*' unstagedstr '%F{red}*'
zstyle ':vcs_info:*' stagedstr '%F{yellow}+'
zstyle ':vcs_info:*' actionformats '%F{5}[%F{2}%b%F{3}|%F{1}%a%c%u%F{5}]%f '
zstyle ':vcs_info:*' formats '%F{5}[%F{2}%b%c%u%F{5}]%f '
zstyle ':vcs_info:svn:*' branchformat '%b'
zstyle ':vcs_info:svn:*' actionformats '%F{5}[%F{2}%b%F{1}:%F{3}%i%F{3}|%F{1}%a%c%u%F{5}]%f '
zstyle ':vcs_info:svn:*' formats '%F{5}[%F{2}%b%F{1}:%F{3}%i%c%u%F{5}]%f '
zstyle ':vcs_info:*' enable git cvs svn
# Functions
theme_precmd () {
vcs_info
}
# Git variables
ZSH_THEME_GIT_PROMPT_PREFIX="Ξ %{$fg_bold[blue]%}git::%{$fg_no_bold[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX=""
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[blue]%}"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[yellow]%} ⚡ %{$fg_bold[blue]%}"
# Prompt variables
setopt prompt_subst
PROMPT='─ %B%{$FG[040]%}[%n]%{$reset_color%} Ʃ '
PROMPT+='%{$FG[033]%}%B[%~/]%{$reset_color%} '
PROMPT+='$(git_prompt_info)'
PROMPT+='
%{$fg[cyan]%}➭%{$reset_color%} '
# # current-time - status Ʃ Ξ
RPROMPT="%* %(?.%{$fg[cyan]%}✓.%{$fg[red]%}✗%{$reset_color%})"
autoload -U add-zsh-hook
add-zsh-hook precmd theme_precmd
@LYNK-INCUU
Copy link

but why do i get this error

[oh-my-zsh] theme 'uysal' not found

@uysalserkan
Copy link
Author

@ZeldrexK0DE hi,
If you want to use theme, you need to save it under ~/.oh-my-zsh/themes/ folder as uysal.zsh-theme.

@miguealejandror
Copy link

I get this error when I open my terminal:

/Users/miguelrivera/.oh-my-zsh/themes/uysal.zsh-theme:13: command not found: %F{5}[%F{2}%b%F{1}:%F{3}%i%F{3}|%F{1}%a%c%u%F{5}]%f
Screenshot 2023-01-11 at 11 25 53 AM

@uysalserkan
Copy link
Author

uysalserkan commented Jan 11, 2023

Hi @miguealejandror,
These variables are built-in zsh variables, Actually I don't know what is the cause of the error but be sure the correct form of theme.

May be this link helps you https://stackoverflow.com/questions/1128496/to-get-a-prompt-which-indicates-git-branch-in-zsh

@tmli3b3rm4n
Copy link

worked for me. Cool theme.

@selcukgural
Copy link

selcukgural commented Feb 2, 2023

Yes, it's working. Thank you...

image

@uysalserkan
Copy link
Author

You're welcome guys :)

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