Skip to content

Instantly share code, notes, and snippets.

@tdkn
Created April 16, 2012 15:16
Show Gist options
  • Save tdkn/2399401 to your computer and use it in GitHub Desktop.
Save tdkn/2399401 to your computer and use it in GitHub Desktop.
.zshrc (自分用)
# ============================================================
## 文字列 "^[" は実際にはエスケープなので置換しないと動かないよ。
#
## Emacs の場合:
# M-x replace-string RET C-q ESC RET ^[ RET とすれば置換。
#
## Vim の場合:
# :%s/\^\[/Ctrl+v ESC/gc とすれば置換。
# ============================================================
# Created by newuser for 4.3.11
# 補完機能のコンフィギュレーション
autoload -U compinit
compinit
# 環境変数 LANG の設定
export LANG=ja_JP.UTF-8
# プロンプトの設定
case ${UID} in
0)
PROMPT="%{^[[32m%}%n%%%{^[[m%} "
RPROMPT="[%~]"
PROMPT2="%B%{^[[32m%}%_#%{^[[m%}%b "
SPROMPT="%B%{^[[32m%}%r is correct? [n,y,a,e]:%{^[[m%}%b "
[ -n "${REMOTEHOST}${SSH_CONNECTION}" ] &&
PROMPT="%{^[[37m%}${HOST%%.*} ${PROMPT}"
;;
*)
PROMPT="%{^[[32m%}%n%%%{^[[m%} "
RPROMPT="[%~]"
PROMPT2="%{^[[32m%}%_%%%{^[[m%} "
SPROMPT="%{^[[32m%}%r is correct? [n,y,a,e]:%{^[[m%} "
[ -n "${REMOTEHOST}${SSH_CONNECTION}" ] &&
PROMPT="%{^[[37m%}${HOST%%.*} ${PROMPT}"
;;
esac
# エイリアスの設定
alias ls='ls --color=auto'
alias grep='grep --color=auto'
alias la='ls -a'
alias lf='ls -F'
alias ll='ls -l'
#alias emacs='emacs -nw'
#alias vi='emacs -nw'
#alias vim='emacs -nw'
#alias gvim='emacs -nw'
# command-history settings
HISTFILE=~/.zsh_history
HISTSIZE=6000000
SAVEHIST=6000000
setopt hist_ignore_dups
setopt share_history
# command-history search settings
autoload history-search-end
zle -N history-beginning-search-backward-end history-search-end
zle -N history-beginning-search-forward-end history-search-end
# "C-p" を "Backword history search" に設定
bindkey "^P" history-beginning-search-backward-end
# "C-n" を "Forword history search" に設定
bindkey "^N" history-beginning-search-forward-end
# ディレクトリ名だけでcd
setopt auto_cd
# 移動したディレクトリを記録
setopt auto_pushd
# コマンド名の間違いを修正
setopt correct
# 補完候補を詰めて表示
setopt list_packed
# ビープ音を鳴らさない
setopt nolistbeep
# Emacs ライクなキーバインドに設定
bindkey -e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment