Skip to content

Instantly share code, notes, and snippets.

@ferd
Created April 1, 2014 01:12
Show Gist options
  • Save ferd/9905862 to your computer and use it in GitHub Desktop.
Save ferd/9905862 to your computer and use it in GitHub Desktop.
ZSH theme for light background
PROMPT='$(prompt_clr)λ %{$fg[grey]%}%1~ $(prompt_mode) $(git_prompt_info)$(hg_prompt_info)%{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$fg[yellow]%} → %{$reset_color%}"
function hg_prompt_info {
hg prompt --angle-brackets "\
<%{$fg[blue]%}<branch>%{$reset_color%}> \
<%{$fg[blue]%}<status|modified|unknown>%{$reset_color%} >" 2>/dev/null
}
function prompt_clr {
git branch >/dev/null 2>/dev/null && echo "%{$fg[red]%}" && return
hg root >/dev/null 2>/dev/null && echo "%{$fg[blue]%}" && return
echo "%{$fg[black]%}"
}
VIMODE='→'
function zle-line-init zle-keymap-select {
VIMODE="${${KEYMAP/vicmd/:}/(main|viins)/→}"
zle reset-prompt
}
zle -N zle-line-init
zle -N zle-keymap-select
function prompt_mode {
echo "%{$fg[red]%}${VIMODE}"
}
@ferd
Copy link
Author

ferd commented Apr 1, 2014

Dark version:

PROMPT='$(prompt_clr)λ %{$fg[green]%}%1~ $(prompt_mode) $(git_prompt_info)$(hg_prompt_info)%{$reset_color%}'

ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$fg[yellow]%} → %{$reset_color%}"

function hg_prompt_info {
    hg prompt --angle-brackets "\
<%{$fg[blue]%}<branch>%{$reset_color%}> \
<%{$fg[blue]%}<status|modified|unknown>%{$reset_color%} >" 2>/dev/null
}

function prompt_clr {
    git branch >/dev/null 2>/dev/null && echo "%{$fg[red]%}" && return
    hg root >/dev/null 2>/dev/null && echo "%{$fg[blue]%}" && return
    echo "%{$fg[yellow]%}"
}

VIMODE='→'
function zle-line-init zle-keymap-select {
 VIMODE="${${KEYMAP/vicmd/:}/(main|viins)/→}"
 zle reset-prompt
}

zle -N zle-line-init
zle -N zle-keymap-select

function prompt_mode {
    echo "%{$fg[red]%}${VIMODE}"
}

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