Skip to content

Instantly share code, notes, and snippets.

@ohneda
Created April 3, 2013 22:56
Show Gist options
  • Save ohneda/5306219 to your computer and use it in GitHub Desktop.
Save ohneda/5306219 to your computer and use it in GitHub Desktop.
# users generic .zshrc file for zsh(1)
## Environment variable configuration
#
# LANG
#
export LANG=ja_JP.UTF-8
## Default shell configuration
#
# set prompt
#
autoload colors
colors
case ${UID} in
0)
PROMPT="%B%{${fg[red]}%}%/#%{${reset_color}%}%b "
PROMPT2="%B%{${fg[red]}%}%_#%{${reset_color}%}%b "
SPROMPT="%B%{${fg[red]}%}%r is correct? [n,y,a,e]:%{${reset_color}%}%b "
[ -n "${REMOTEHOST}${SSH_CONNECTION}" ] &&
PROMPT="%{${fg[white]}%}${HOST%%.*} ${PROMPT}"
;;
*)
PROMPT="%{%F{214}%}%/%%%f "
PROMPT2="%{%F{214}%}%_%%%f "
SPROMPT="%F{red}%}%r is correct? [n,y,a,e]:%{${reset_color}%} "
[ -n "${REMOTEHOST}${SSH_CONNECTION}" ] &&
PROMPT="%{${fg[white]}%}${HOST%%.*} ${PROMPT}"
;;
esac
# auto change directory
#
setopt auto_cd
# auto directory pushd that you can get dirs list by cd -[tab]
#
setopt auto_pushd
# command correct edition before each completion attempt
#
setopt correct
# compacked complete list display
#
setopt list_packed
# no remove postfix slash of command line
#
setopt noautoremoveslash
# no beep sound when complete list displayed
#
setopt nolistbeep
## Keybind configuration
#
# emacs like keybind (e.x. Ctrl-a goes to head of a line and Ctrl-e goes
# to end of it)
#
bindkey -e
# historical backward/forward search with linehead string binded to ^P/^N
#
autoload history-search-end
zle -N history-beginning-search-backward-end history-search-end
zle -N history-beginning-search-forward-end history-search-end
bindkey "^p" history-beginning-search-backward-end
bindkey "^n" history-beginning-search-forward-end
bindkey "\\ep" history-beginning-search-backward-end
bindkey "\\en" history-beginning-search-forward-end
## Command history configuration
#
HISTSIZE=10000
SAVEHIST=10000
setopt hist_ignore_dups # ignore duplication command history list
setopt append_history
setopt share_history # share command history data
## Completion configuration
#
autoload -U compinit
#compinit
## Alias configuration
#
# expand aliases before completing
#
setopt complete_aliases # aliased ls needs if file/dir completions work
alias where="command -v"
alias j="jobs -l"
case "${OSTYPE}" in
freebsd*|darwin*)
alias ls="ls -G -w"
;;
linux*)
alias ls="ls --color"
;;
esac
alias la="ls -a"
alias lf="ls -F"
alias ll="ls -l"
alias du="du -h"
alias df="df -h"
alias su="su -l"
## terminal configuration
#
unset LSCOLORS
case "${TERM}" in
xterm)
export TERM=xterm-color
;;
kterm)
export TERM=kterm-color
# set BackSpace control character
stty erase
;;
cons25)
unset LANG
export LSCOLORS=ExFxCxdxBxegedabagacad
export LS_COLORS='di=01;34:ln=01;35:so=01;32:ex=01;31:bd=46;34:cd=43;34:su=41;30:sg=46;30:tw=42;30:ow=43;30'
zstyle ':completion:*' list-colors \
'di=;34;1' 'ln=;35;1' 'so=;32;1' 'ex=31;1' 'bd=46;34' 'cd=43;34'
;;
esac
# set terminal title including current directory
#
case "${TERM}" in
kterm*|xterm*)
precmd() {
echo -ne "\033]0;${USER}@${HOST%%.*}:${PWD}\007"
}
export LSCOLORS=exfxcxdxbxegedabagacad
export LS_COLORS='di=34:ln=35:so=32:pi=33:ex=31:bd=46;34:cd=43;34:su=41;30:sg=46;30:tw=42;30:ow=43;30'
zstyle ':completion:*' list-colors \
'di=34' 'ln=35' 'so=32' 'ex=31' 'bd=46;34' 'cd=43;34'
;;
esac
export MAVEN_OPTS=-Xmx512M
export GIT_PAGER=lv
export PATH=${HOME}/bin:/usr/local/bin:${PATH}:/usr/local/sbin
alias grails="grails-version grails"
export _JAVA_OPTIONS="-Dfile.encoding=UTF-8"
export GRAILS_OPTS="-server -Xmx1024M -XX:MaxPermSize=512m -Dfile.encoding=UTF-8"
autoload -Uz vcs_info
zstyle ':vcs_info:*' formats '(%s)-[%b]'
zstyle ':vcs_info:*' actionformats '(%s)-[%b|%a]'
precmd () {
psvar=()
LANG=en_US.UTF-8 vcs_info
[[ -n "$vcs_info_msg_0_" ]] && psvar[1]="$vcs_info_msg_0_"
}
RPROMPT="%1(v|%F{green}%1v%f|)"
export LV='-Ou8 -c'
export GIT_PAGER='cat'
export GIT_EDITOR=/usr/bin/vim
export EDITOR=/usr/bin/vim
# load user .zshrc configuration file
#
[ -f ~/.zshrc.mine ] && source ~/.zshrc.mine
# 256色確認
function pcolor() {
for ((f = 0; f < 255; f++)); do
printf "\e[38;5;%dm %3d*■\e[m" $f $f
if [[ $f%8 -eq 7 ]] then
printf "\n"
fi
done
echo
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment