Skip to content

Instantly share code, notes, and snippets.

@justforuse
Created August 23, 2022 10:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justforuse/cdb0be369baa31164f3656f43426877c to your computer and use it in GitHub Desktop.
Save justforuse/cdb0be369baa31164f3656f43426877c to your computer and use it in GitHub Desktop.
A theme for oh my zsh. (extends from robbyrussell)
PROMPT="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ )"
PROMPT+=' %{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info) ⌚ %{$fg_bold[magenta]%}%*%{$reset_color%}
%(?:%{$fg_bold[green]%}$ :%{$fg_bold[red]%}$ )'
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[yellow]%}git:(%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%}) %{$fg[yellow]%}✗"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[yellow]%})"
@justforuse
Copy link
Author

  1. Move the input cursor at a new line
  2. Add current time

image

@justforuse
Copy link
Author

function node_prompt_version {
    if which node &> /dev/null; then
        echo "%{$fg[green]%}⬢ $(node -v) %{$reset_color%}"
    fi
}

PROMPT="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ )"
PROMPT+=' %{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info) ⌚ %{$fg_bold[magenta]%}%*%{$reset_color%}
%(?:%{$fg_bold[green]%}$ :%{$fg_bold[red]%}$ )'

RPROMPT='%{$(echotc UP 1)%}$(node_prompt_version)%{$(echotc DO 1)%}'


ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[yellow]%} %{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[yellow]%}✗"
ZSH_THEME_GIT_PROMPT_CLEAN=""

Feature

  • Add node version
  • Git branch text

image

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