Skip to content

Instantly share code, notes, and snippets.

@m-mizutani
Created March 28, 2017 11:35
Show Gist options
  • Save m-mizutani/e806a5644dc4908534402da0a5e8b31c to your computer and use it in GitHub Desktop.
Save m-mizutani/e806a5644dc4908534402da0a5e8b31c to your computer and use it in GitHub Desktop.
export EDITOR=vim # エディタをvimに設定
export LANG=ja_JP.UTF-8 # 文字コードをUTF-8に設定
export LC_ALL=ja_JP.UTF-8
export LC_TYPE=ja_JP.UTF-8
export AUTOFEATURE=true # autotestでfeatureを動かす
if [ -e $HOME/.rbenv ] ; then
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
fi
if [ -e $HOME/.pyenv ] ; then
export PYENV_ROOT=$HOME/.pyenv
export PATH=$PYENV_ROOT/bin:$PATH
eval "$(pyenv init -)"
fi
if [ -e /usr/texbin/ ] ; then
export PATH="/usr/texbin:$PATH"
fi
export GOPATH=$HOME/works/godev
export PATH=$PATH:/usr/local/bin:/usr/local/sbin:$HOME/local/bin:$GOPATH/bin
alias ls='ls -F' la='ls -a' ll='ls -la'
alias em='emacs -nw'
# alias em='/Applications/Emacs.app/Contents/MacOS/Emacs -nw'
alias ,='open .'
alias tn='terminal-notifier -message'
alias pg='ping 8.8.8.8'
alias lv='lv -c'
bindkey -e # キーバインドをemacsモードに設定
#補完機能を使用する
autoload -U compinit promptinit
compinit
zstyle ':completion::complete:*' use-cache true
#zstyle ':completion:*:default' menu select true
zstyle ':completion:*:default' menu select=1
#大文字、小文字を区別せず補完する
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
#補完でカラーを使用する
autoload colors
zstyle ':completion:*' list-colors "${LS_COLORS}"
#kill の候補にも色付き表示
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([%0-9]#)*=0=01;31'
#コマンドにsudoを付けても補完
zstyle ':completion:*:sudo:*' command-path /usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin /usr/X11R6/bin
autoload history-search-end
zle -N history-beginning-search-backward-end history-search-end
zle -N history-beginning-search-forward-end history-search-end
HISTFILE=~/.zsh_history # ヒストリを保存するファイル
HISTSIZE=10000 # メモリに保存されるヒストリの件数
SAVEHIST=10000 # 保存されるヒストリの件数
setopt bang_hist # !を使ったヒストリ展開を行う(d)
setopt extended_history # ヒストリに実行時間も保存する
setopt hist_ignore_dups # 直前と同じコマンドはヒストリに追加しない
setopt share_history # 他のシェルのヒストリをリアルタイムで共有する
setopt hist_reduce_blanks # 余分なスペースを削除してヒストリに保存する
### Ls Color ###
# 色の設定
export LSCOLORS=Exfxcxdxbxegedabagacad
# 補完時の色の設定
# export LS_COLORS='di=01;34:ln=01;35:so=01;32:ex=01;31:bd=46;34:cd=43;34:su=41;30:sg=46;30:tw=42;30:ow=43;30'
# ZLS_COLORSとは?
export ZLS_COLORS=$LS_COLORS
# lsコマンド時、自動で色がつく(ls -Gのようなもの?)
# export CLICOLOR=true
# 補完候補に色を付ける
# zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
### Prompt ###
# プロンプトに色を付ける
autoload -U colors; colors
# 一般ユーザ時
# tmp_prompt="%{${fg[cyan]}%}%n%# %{${reset_color}%}"
tmp_prompt="%{${fg[cyan]}%}%# %{${reset_color}%}"
tmp_prompt2="%{${fg[cyan]}%}%_> %{${reset_color}%}"
tmp_rprompt="%{${fg[green]}%}[%~]%{${reset_color}%}"
tmp_sprompt="%{${fg[yellow]}%}%r is correct? [Yes, No, Abort, Edit]:%{${reset_color}%}"
# rootユーザ時(太字にし、アンダーバーをつける)
if [ ${UID} -eq 0 ]; then
tmp_prompt="%B%U${tmp_prompt}%u%b"
tmp_prompt2="%B%U${tmp_prompt2}%u%b"
tmp_rprompt="%B%U${tmp_rprompt}%u%b"
tmp_sprompt="%B%U${tmp_sprompt}%u%b"
fi
PROMPT=$tmp_prompt # 通常のプロンプト
PROMPT2=$tmp_prompt2 # セカンダリのプロンプト(コマンドが2行以上の時に表示される)
RPROMPT=$tmp_rprompt # 右側のプロンプト
SPROMPT=$tmp_sprompt # スペル訂正用プロンプト
# SSHログイン時のプロンプト
[ -n "${REMOTEHOST}${SSH_CONNECTION}" ] &&
PROMPT="%{${fg[white]}%}${HOST%%.*} ${PROMPT}"
;
### Added by the Bluemix CLI
source /usr/local/Bluemix/bx/zsh_autocomplete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment