Created
November 6, 2011 19:07
-
-
Save thomcc/1343323 to your computer and use it in GitHub Desktop.
zsh theme
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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