Skip to content

Instantly share code, notes, and snippets.

@myanbin
Created August 15, 2012 04:52
Show Gist options
  • Save myanbin/3356065 to your computer and use it in GitHub Desktop.
Save myanbin/3356065 to your computer and use it in GitHub Desktop.
彩色终端
alias code='cd /cygdrive/n/code'
alias ls='ls --color'
# Candy colored terminal
# write on 2012/08
__git_ps1() {
local b="$(git symbolic-ref HEAD 2>/dev/null)"
if [ -n "$b" ]; then
printf "(%s)" "${b##refs/heads/}"
fi
}
D=$'\e[37;40m'
RED=$'\e[0;31m'
BLUE=$'\e[0;34m'
PINK=$'\e[35;40m'
GREEN=$'\e[32;40m'
ORANGE=$'\e[33;40m'
export PS1="\n${PINK}\u ${D}at ${ORANGE}\h ${D}in ${GREEN}\w ${RED}\$(__git_ps1)${D}\n$ "
#Colored man pages
man() {
env \
LESS_TERMCAP_mb=$(printf "\e[1;31m") \
LESS_TERMCAP_md=$(printf "\e[1;31m") \
LESS_TERMCAP_me=$(printf "\e[0m") \
LESS_TERMCAP_se=$(printf "\e[0m") \
LESS_TERMCAP_so=$(printf "\e[1;44;33m") \
LESS_TERMCAP_ue=$(printf "\e[0m") \
LESS_TERMCAP_us=$(printf "\e[1;32m") \
man "$@"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment