Skip to content

Instantly share code, notes, and snippets.

@mazgi
Created May 15, 2012 00:19
Show Gist options
  • Save mazgi/2698240 to your computer and use it in GitHub Desktop.
Save mazgi/2698240 to your computer and use it in GitHub Desktop.
MacOSX/Linuxあたりで使ってるzshrc
autoload colors
colors
UID_COLOR=${fg[green]}
case ${UID} in
0)
UID_COLOR=${fg[red]}
;;
*)
;;
esac
PROMPT="[%{$UID_COLOR%}%n%{${reset_color}%}@%m] %(!.#.$) "
PROMPT2="%{${fg[blue]}%}%_> %{${reset_color}%}"
SPROMPT="%{${fg[red]}%}correct: %R -> %r [nyae]? %{${reset_color}%}"
RPROMPT="%{${fg[blue]}%}[%~]%{${reset_color}%}"
bindkey ' ' magic-space # also do history expansion on space
#WORDCHARS='*?_-.[]~=&;!#$%^(){}<>'
WORDCHARS='*'
#------------------------------------------------
#| wordとみなす文字を羅列。
#| C-wタイプすると、このword単位で削れる。
#| $ vi /etc/conf.d/keymaps[C-w]
#| $ vi /etc/conf.d/
#| ・・・みたいな
#------------------------------------------------
bindkey -e # emacsっぽい
#bindkey -v # vi風味
alias -g G='| grep '
alias -g M='| more '
alias ls='ls -FG' # Mac
#alias ls='ls -FGv --color' # Linux
alias ll='ls -l'
alias la='ls -a'
alias be='bundle exec'
setopt auto_pushd
#------------------------------------------------
#| こんなカンジで、cdしたディレクトリをpushd
#| $ cd hoge
#| $ ls
#| hoga/ huge/ hunya/
#| $ pwd
#| /ANY/hoge
#| $ cd hoga
#| $ cd ../huge
#| $ cd ../hunya
#| $ cd -[TAB]
#| 0 -- /ANY
#| 1 -- /ANY/hoge
#| 2 -- /ANY/hoge/hoga
#| 3 -- /ANY/hoge/huge
#| じつはhunyaかfunyaかは悩みどころ
#------------------------------------------------
setopt pushd_ignore_dups # スタックから重複排除
setopt correct
#------------------------------------------------
#| こんなカンジで「それ、typoじゃね?」とか聞いてくれる
#| $ sl
#| zsh: correct 'sl' to 'ls' [nyae]?
#| あたりまえだけどsl導入済みの時はSLが走ります。
#------------------------------------------------
autoload compinit # 色々補完
compinit
# compinit -u # Cygwinの時は-u付けてパーミッションのテストをスルーしないと都合悪かったはず。
HISTFILE=$HOME/.zsh-history # 履歴をファイルに保存する
HISTSIZE=100000 # メモリ内の履歴の数
SAVEHIST=100000 # 保存される履歴の数
setopt share_history # 複数のセッションで履歴を共有
setopt hist_ignore_all_dups # 履歴から重複排除
setopt extended_history # 履歴ファイルに時刻を記録
function history-all { history -E 1 } # 全履歴の一覧を出力する
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment