Skip to content

Instantly share code, notes, and snippets.

@yohm
Created July 23, 2011 01:00
Show Gist options
  • Save yohm/1100796 to your computer and use it in GitHub Desktop.
Save yohm/1100796 to your computer and use it in GitHub Desktop.
dot_zshrc file
# 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
# emacs key bind
#
bindkey -e
# completion configuration
autoload -U compinit
compinit -u
# zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}' '+m:{A-Z}={a-z}'
#### history
HISTFILE="$HOME/.zhistory"
HISTSIZE=10000
SAVEHIST=10000
#### option, limit, bindkey
setopt hist_ignore_all_dups
setopt hist_reduce_blanks
setopt share_history
bindkey '^P' history-beginning-search-backward
bindkey '^N' history-beginning-search-forward
## 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"
alias vi="vim"
alias o="open"
alias ql='qlmanage -p "$@" >& /dev/null'
case "${OSTYPE}" in
freebsd*|darwin*)
alias ls="ls -G"
;;
linux*)
alias ls="ls --color"
;;
esac
alias la="ls -a"
alias lf="ls -F"
alias ll="ls -lh"
alias rm="rm -i"
alias mv="mv -i"
alias cp="cp -i"
function rmtil() {rm -f ./*~ && rm ./*.bak}
alias rmo="rm ./*.o"
alias du="du -h"
alias df="df -h"
alias su="su -l"
alias more="less"
# ls after cd
#
function cd() { builtin cd $@ && ls -G; }
# change encoding into euc.
#
function euc() {
for i in $@; do;
nkf -e -Lu $i >! /tmp/euc.$$
mv -f /tmp/euc.$$ $i
done;
}
# change encoding into sjis.
function sjis() {
for i in $@; do;
nkf -s -Lw $i >! /tmp/euc.$$
mv -f /tmp/euc.$$ $i
done;
}
local WATER=$'%{\e[0;36m%}'
local PURPLE=$'%{\e[0;35m%}'
local BLUE=$'%{\e[0;34m%}'
local YELLOW=$'%{\e[0;33m%}'
local GREEN=$'%{\e[0;32m%}'
local RED=$'%{\e[0;31m%}'
local BLACK=$'%{\e[0;30m%}'
local GLAY=$'%{\e[0;37m%}'
local DEFAULT=$'%{\e[1;00m%}' #http://www.machu.jp/b/zsh.html
export PROMPT=$WATER'[${USER}@ ${HOST}] '$DEFAULT
export RPROMPT=$YELLOW'[%~]'$DEFAULT
setopt PROMPT_SUBST
export LSCOLORS=di=32:ln=35:ex=31:bd=47
export LSCOLORS=cxfxgxdxbxegedabagacad
## mount network drive
fmount () {
echo "mounting $1"
osascript -e "tell application \"Finder\" to mount volume \"$1\""
}
## load user .zshrc configuration file
#
[ -f ~/.zshrc.mine ] && source ~/.zshrc.mine
# colorize the completion list
zstyle ':completion:*' list-colors $LSCOLORS
disable r
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment