Skip to content

Instantly share code, notes, and snippets.

@ponko2
Created March 20, 2013 17:41
Show Gist options
  • Select an option

  • Save ponko2/5206755 to your computer and use it in GitHub Desktop.

Select an option

Save ponko2/5206755 to your computer and use it in GitHub Desktop.
oh-my-zshの設定ファイル
# 補完候補を詰めて表示
setopt list_packed
# カッコの対応などを自動的に補完
setopt auto_param_keys
# ディレクトリ名の補完で末尾の / を自動的に付加し、次の補完に備える
#setopt auto_param_slash
# ファイル名の展開でディレクトリにマッチした場合末尾に / を付加する
#setopt mark_dirs
# 最後のスラッシュを自動的に削除しない
#setopt noautoremoveslash
# {a-c} を a b c に展開する機能を使えるようにする
setopt brace_ccl
# =command を command のパス名に展開する
setopt equals
# ファイル名の展開で辞書順ではなく数値的にソート
setopt numeric_glob_sort
# --prefix=/usr などの = 以降も補完
setopt magic_equal_subst
# Git ルートディレクトリ移動
function git-root() {
if git rev-parse --is-inside-work-tree > /dev/null 2>&1; then
cd `git rev-parse --show-toplevel`
fi
}
alias gr="git-root"
## Command history configuration
if [ -d $HOME/Dropbox/History ]; then
HISTFILE=$HOME/Dropbox/History/.zsh_history
else
HISTFILE=$HOME/.zsh_history
fi
HISTSIZE=10000
SAVEHIST=10000
# history (fc -l) no store
setopt hist_no_store
# 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
# history incremental search
if zle -la | grep -q '^history-incremental-pattern-search'; then
bindkey '^r' history-incremental-pattern-search-backward
bindkey '^s' history-incremental-pattern-search-forward
else
bindkey '^r' history-incremental-search-backward
bindkey '^s' history-incremental-search-forward
fi
# 直前のコマンドの最後の単語を挿入
autoload smart-insert-last-word
zle -N insert-last-word smart-insert-last-word
zstyle :insert-last-word match '*([^[:space:]][[:alpha:]/\\]|[[:alpha:]/\\][^[:space:]])*'
bindkey '^]' insert-last-word
# undo/redo
bindkey "^[u" undo
bindkey "^[r" redo
# rename
autoload -Uz zmv
# 8bit Japanese File support
setopt print_eightbit
# OSX濁点半濁点
setopt combining_chars
convert-utf8-mac () {
BUFFER=`iconv -f utf8 -t utf8-mac <(<<<"$BUFFER")`
zle -M 'Convert to UTF8-MAC'
}
zle -N convert-utf8-mac
bindkey '^X"' convert-utf8-mac
# Ctrl+D -> use exit or logout
setopt ignore_eof
# Ctrl+S/Ctrl+Q No flow control
setopt no_flow_control
# コマンドラインでも # 以降をコメントと見なす
setopt interactive_comments
# for, repeat, select, if, function support
setopt short_loops
# CTRL-s
if [ "$TERM" != "dumb" ]; then
stty -ixon;
fi
# no beep
setopt nolistbeep
setopt no_beep
# alias
setopt complete_aliases
alias :q="exit"
alias vi='vim'
case "${OSTYPE}" in
linux*)
alias pbcopy='xsel --input --clipboard'
alias open='gnome-open'
;;
cygwin*)
alias pbcopy='putclip'
alias open='cygstart'
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment