Skip to content

Instantly share code, notes, and snippets.

@cataska
Created July 24, 2013 06:03
Show Gist options
  • Save cataska/6068363 to your computer and use it in GitHub Desktop.
Save cataska/6068363 to your computer and use it in GitHub Desktop.
zshrc
# Created by newuser for 5.0.0
autoload -U compinit
compinit
# Completion caching
zstyle ':completion::complete:*' use-cache on
zstyle ':completion::complete:*' cache-path .zcache
#Completion Options
zstyle ':completion:*:match:*' original only
zstyle ':completion::prefix-1:*' completer _complete
zstyle ':completion:predict:*' completer _complete
zstyle ':completion:incremental:*' completer _complete _correct
zstyle ':completion:*' completer _complete _prefix _correct _prefix _match _approximate
# Path Expansion
zstyle ':completion:*' expand 'yes'
zstyle ':completion:*' squeeze-shlashes 'yes'
zstyle ':completion::complete:*' '\\'
zstyle ':completion:*:*:default' force-list always
autoload colors zsh/terminfo
if [[ "$terminfo[colors]" -ge 8 ]]; then
colors
fi
for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE GREY; do
eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}'
eval PR_LIGHT_$color='%{$fg[${(L)color}]%}'
(( count = $count + 1 ))
done
PR_NO_COLOR="%{$terminfo[sgr0]%}"
prompt_adam2_color3=${3:-'cyan'} # user@host
PR_USRHOST_COLOR="%{$fg_no_bold[$prompt_adam2_color3]%}"
PR_ATSIGN_COLOR="%{$fg_bold[$prompt_adam2_color3]%}"
# Set Prompt
#PS1="$PR_LIGHT_MAGENTA%n$PR_LIGHT_RED@$PR_LIGHT_CYAN%m$PR_NO_COLOR [$PR_LIGHT_YELLOW%2c$PR_NO_COLOR] $PR_GREY>$PR_LIGHT_GREEN>$PR_CYAN>$PR_NO_COLOR "
#PS1="$PR_LIGHT_MAGENTA%n$PR_LIGHT_RED@$PR_LIGHT_CYAN%m$PR_NO_COLOR $PR_WHITE%{[%}$PR_LIGHT_YELLOW%2c$PR_WHITE]$PR_NO_COLOR $PR_GREY>$PR_LIGHT_GREEN>$PR_CYAN>$PR_NO_COLOR "
PS1="$PR_USRHOST_COLOR%n$PR_ATSIGN_COLOR@$PR_USRHOST_COLOR%m$PR_NO_COLOR [$PR_LIGHT_YELLOW%2c$PR_NO_COLOR] $PR_GREY>$PR_LIGHT_GREEN>$PR_CYAN>$PR_NO_COLOR "
#PS1="%n@%m [$PR_LIGHT_YELLOW%2c$PR_NO_COLOR] $PR_GREY>$PR_LIGHT_GREEN>$PR_CYAN>$PR_NO_COLOR "
#PS1="%2c [%n@%m]$ "
#PS1="%n@%m [%2c]$ "
#RPS1="[%D{%Y-%m-%d %k:%M}]"
# Colorful prompt
#PS1="$PR_LIGHT_GREEN%n$PR_GREY@$PR_CYAN%m$PR_GREY:$PR_LIGHT_RED%2c$PR_NO_COLOR$ "
#RPS1="[$PR_LIGHT_YELLOW%D{%Y-%m-%d %k:%M}$PR_NO_COLOR]"
LANG='zh_TW.UTF-8'
HISTSIZE=500
HISTFILE=~/.zsh_history
SAVEHIST=500
# enable color support of ls and also add handy aliases
if [ "$TERM" != "dumb" ]; then
eval "`dircolors -b`"
alias ls='ls --color=auto'
#alias dir='ls --color=auto --format=vertical'
#alias vdir='ls --color=auto --format=long'
fi
# Emacs ansi-term directory tracking
# track directory, username, and cwd for remote logons
if [ $TERM = eterm-color ]; then
function eterm-set-cwd {
$@
echo -e "\033AnSiTc" $(pwd)
}
# set hostname, user, and cwd
function eterm-reset {
echo -e "\033AnSiTu" $(whoami)
echo -e "\033AnSiTc" $(pwd)
echo -e "\033AnSiTh" $(hostname)
}
for temp in cd pushd popd; do
alias $temp="eterm-set-cwd $temp"
done
# set hostname, user, and cwd now
eterm-reset
fi
# Command not found
function command_not_found_handler() {
if [[ -x /usr/lib/command-not-found ]] ; then
/usr/lib/command-not-found --no-failure-msg -- $1
return 0
else
printf "%s: command not found\n" "$1" >&2
return 127
fi
}
jj() {
num=$1
test $1 || num=1
next=`printf '../%.0s' {1..$num}`
cd $next
}
alias ll='ls -alF'
alias la='ls -A'
alias lla='ls -lA'
alias llh='ls -lAh'
alias e='vim'
alias agi='sudo apt-get install'
alias acs='apt-cache search'
alias acsh='apt-cache show'
alias more='less'
# set PATH so it includes user's private bin if it exists
if [ -d ~/bin ] ; then
PATH=~/bin:"${PATH}"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment