Twitterにて @shinji_kono さんにzshをお勧めしていただいたので、長年つかったcsh・tcshからzshへ入門する。
インストール
% sudo aptitude install zsh % chsh USER_NAME
.zshrcの設定
漢のzshのおすすめ設定とおりに書いた。
## Language export LANG=ja_JP.UTF-8 ## Prompt case ${UID} in 0) PROMPT="%B%{^[[31m%}%/#%{^[[m%}%b " # ^[ は、エスケープシーケンス。Ctrl-q ESC で入力 PROMPT2="%B%{^[[31m%}%_#%{^[[m%}%b " SPROMPT="%B%{^[[31m%}%r is correct? [n,y,a,e]:%{^[[m%}%b " [ -n "${REMOTEHOST}${SSH_CONNECTION}" ] && PROMPT="%{^[[37m%}${HOST%%.*} ${PROMPT}" ;; *) PROMPT="%{^[[31m%}%/%%%{^[[m%} " PROMPT2="%{^[[31m%}%_%%%{^[[m%} " SPROMPT="%{^[[31m%}%r is correct? [n,y,a,e]:%{^[[m%} " [ -n "${REMOTEHOST}${SSH_CONNECTION}" ] && PROMPT="%{^[[37m%}${HOST%%.*} ${PROMPT}" ;; esac ## 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 # For history HISTFILE=~/.zsh_history HISTSIZE=10000 SAVEHIST=10000 setopt hist_ignore_dups # ignore duplication command history list setopt share_history # share command history data # Autocomplite autoload -U compinit compinit setopt auto_pushd setopt correct setopt list_packed setopt nolistbeep setopt noautoremoveslash ## alias setopt complete_aliases alias ls='ls -F' alias rm='rm -i' alias cp='cp -i' alias rm='rm -i' alias cp='cp -i' alias mv='mv -i' alias sl='ls' ## specific configuration for me [ -f ~/.zshrc.mine ] && source ~/.zshrc.mine
設定を反映させる。
% source ~/.zshrc