Skip to content

Instantly share code, notes, and snippets.

@thomcc
Created November 6, 2011 19:07
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 thomcc/1343323 to your computer and use it in GitHub Desktop.
Save thomcc/1343323 to your computer and use it in GitHub Desktop.
zsh theme
autoload -U add-zsh-hook
autoload colors
colors
function zsh_prompt_command() {
local pwdmaxlen=25
local trunc_symbol=".."
local dir=${PWD##*/}
pwdmaxlen=$(( ( pwdmaxlen < ${#dir} ) ? ${#dir} : pwdmaxlen ))
NEW_PWD=${PWD/#$HOME/\~}
local pwdoffset=$(( ${#NEW_PWD} - pwdmaxlen ))
if [ ${pwdoffset} -gt "0" ]
then
NEW_PWD=${NEW_PWD:$pwdoffset:$pwdmaxlen}
NEW_PWD=${trunc_symbol}/${NEW_PWD#*/}
fi
}
if [[ $TERM = *256color* || $TERM = *rxvt* ]]; then
turquoise="%F{81}"
orange="%F{166}"
purple="%F{135}"
hotpink="%F{161}"
limegreen="%F{118}"
else
turquoise="$fg[cyan]"
orange="$fg[yellow]"
purple="$fg[magenta]"
hotpink="$fg[red]"
limegreen="$fg[green]"
fi
add-zsh-hook precmd zsh_prompt_command
HOST=${$(hostname -s)/Lambda/λ}
PROMPT=$'%{$orange%}${HOST}:%{$reset_color%} %{$purple%}%n%{$reset_color%} %{$limegreen%}${NEW_PWD}%{$reset_color%} '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment