Created
October 26, 2017 05:28
-
-
Save jumbo-in-Jap/5e35347dbded2123e2332f1fec84b503 to your computer and use it in GitHub Desktop.
.zshrc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ------------------------------------- | |
# 環境変数 | |
# ------------------------------------- | |
autoload -Uz compinit | |
compinit -u | |
# SSHで接続した先で日本語が使えるようにする | |
export LC_CTYPE=en_US.UTF-8 | |
export LC_ALL=en_US.UTF-8 | |
# エディタ | |
export EDITOR=/usr/bin/vim | |
# ページャ | |
export PAGER=/usr/bin/less | |
export MANPAGER=/usr/local/bin/vimpager | |
# ------------------------------------- | |
# zshのオプション | |
# ------------------------------------- | |
## 補完機能の強化 | |
autoload -U compinit | |
compinit | |
## 入力しているコマンド名が間違っている場合にもしかして:を出す。 | |
setopt correct | |
# ビープを鳴らさない | |
setopt nobeep | |
## 色を使う | |
setopt prompt_subst | |
## ^Dでログアウトしない。 | |
setopt ignoreeof | |
## バックグラウンドジョブが終了したらすぐに知らせる。 | |
setopt no_tify | |
## 直前と同じコマンドをヒストリに追加しない | |
setopt hist_ignore_dups | |
# 補完 | |
## タブによるファイルの順番切り替えをしない | |
unsetopt auto_menu | |
# cd -[tab]で過去のディレクトリにひとっ飛びできるようにする | |
setopt auto_pushd | |
# ディレクトリ名を入力するだけでcdできるようにする | |
setopt auto_cd | |
# ------------------------------------- | |
# パス | |
# ------------------------------------- | |
# 重複する要素を自動的に削除 | |
typeset -U path cdpath fpath manpath | |
path=( | |
$HOME/bin(N-/) | |
/usr/local/bin(N-/) | |
/usr/local/sbin(N-/) | |
$path | |
) | |
# ------------------------------------- | |
# プロンプト | |
# ------------------------------------- | |
autoload -U promptinit; promptinit | |
autoload -Uz colors; colors | |
autoload -Uz vcs_info | |
autoload -Uz is-at-least | |
# begin VCS | |
zstyle ":vcs_info:*" enable git svn hg bzr | |
zstyle ":vcs_info:*" formats "(%s)-[%b]" | |
zstyle ":vcs_info:*" actionformats "(%s)-[%b|%a]" | |
zstyle ":vcs_info:(svn|bzr):*" branchformat "%b:r%r" | |
zstyle ":vcs_info:bzr:*" use-simple true | |
zstyle ":vcs_info:*" max-exports 6 | |
if is-at-least 4.3.10; then | |
zstyle ":vcs_info:git:*" check-for-changes true # commitしていないのをチェック | |
zstyle ":vcs_info:git:*" stagedstr "<S>" | |
zstyle ":vcs_info:git:*" unstagedstr "<U>" | |
zstyle ":vcs_info:git:*" formats "(%b) %c%u" | |
zstyle ":vcs_info:git:*" actionformats "(%s)-[%b|%a] %c%u" | |
fi | |
function vcs_prompt_info() { | |
LANG=en_US.UTF-8 vcs_info | |
[[ -n "$vcs_info_msg_0_" ]] && echo -n " %{$fg[yellow]%}$vcs_info_msg_0_%f" | |
} | |
# end VCS | |
OK="^_^ " | |
NG="X_X " | |
PROMPT="%{$fg_bold[blue]%}${HOST} " | |
PROMPT+="%(?.%F{green}$OK%f.%F{red}$NG%f) " | |
PROMPT+="%F{blue}%~%f" | |
PROMPT+="\$(vcs_prompt_info)" | |
PROMPT+=" | |
" | |
PROMPT+="%% " | |
RPROMPT="[%*]" | |
# ------------------------------------- | |
# エイリアス | |
# ------------------------------------- | |
# -n 行数表示, -I バイナリファイル無視, svn関係のファイルを無視 | |
alias grep="grep --color -n -I --exclude='entries' --exclude='*/cache/*'" | |
# ls | |
# alias ls="ls -ls" # color for darwin | |
# alias l="ls -la" | |
alias la="ls -la" | |
alias l1="ls -1" | |
# tree | |
alias tree="tree -NC" # N: 文字化け対策, C:色をつける | |
export PATH=$PATH:/usr/local/bin: | |
alias mvi="mvim --remote-tab-silent" | |
#alias ls='ls -G' | |
alias mvim='env LANG=ja_JP.UTF-8 /Applications/MacVim.app/Contents/MacOS/MacVim ' | |
#bash | |
alias bashv='vim ~/.bashrc' | |
alias bashc='cat ~/.bashrc' | |
alias bashs='source ~/.bashrc' | |
#key command | |
alias keyoff='sudo kextunload /System/Library/Extensions/AppleUSBTopCase.kext/Contents/PlugIns/AppleUSBTCKeyboard.kext/' | |
alias keyon='sudo kextload /System/Library/Extensions/AppleUSBTopCase.kext/Contents/PlugIns/AppleUSBTCKeyboard.kext/' | |
# for git | |
alias gst='git status -s -b' | |
alias gci='git commit' | |
alias gdi='git diff' | |
alias gdc='git diff --cached' | |
alias gad='git add' | |
alias gcom='git commit -m "' | |
alias gcm='git checkout master' | |
alias gcb='git checkout -b' | |
alias gcd='git branch -d' | |
alias gbr='git branch' | |
alias glg='git log' | |
alias gdif='git diff' | |
# checkout | |
alias gch="git checkout" | |
alias gcm="git checkout master" | |
alias glog="git log -g --abbrev-commit --pretty=oneline" | |
# pull,push | |
alias gplm="git pull origin master" | |
alias gps="git push origin" | |
#clone | |
alias gcl='git clone ' | |
# for shortcut | |
alias up='cd ..' | |
alias upp='cd ../..' | |
alias uppp='cd ../../..' | |
#alias ls='ls -GwF' | |
alias la='ls -alh' | |
alias t='tar zxvf' | |
alias t-='tar xvf -' | |
alias b='bzip2 -dc' | |
alias dh='df -h' | |
alias vi='vim' | |
alias v='vim' | |
alias sr='screen -d -R' | |
# ------------------------------------- | |
# キーバインド | |
# ------------------------------------- | |
bindkey -e | |
function cdup() { | |
echo | |
cd .. | |
zle reset-prompt | |
} | |
zle -N cdup | |
bindkey '^K' cdup | |
bindkey "^R" history-incremental-search-backward | |
# ------------------------------------- | |
# その他 | |
# ------------------------------------- | |
# cdしたあとで、自動的に ls する | |
function chpwd() { ls -1 } | |
# iTerm2のタブ名を変更する | |
function title { | |
echo -ne "\033]0;"$*"\007" | |
} | |
PERL_MB_OPT="--install_base \"/Users/hanedakentarou/perl5\""; export PERL_MB_OPT; | |
PERL_MM_OPT="INSTALL_BASE=/Users/hanedakentarou/perl5"; export PERL_MM_OPT; | |
# ruby | |
export PATH=$HOME/.rbenv/shims:$PATH | |
# 履歴ファイルの保存先 | |
export HISTFILE=${HOME}/.zsh_history | |
# メモリに保存される履歴の件数 | |
export HISTSIZE=1000 | |
# 履歴ファイルに保存される履歴の件数 | |
export SAVEHIST=100000 | |
# 重複を記録しない | |
setopt hist_ignore_dups | |
# 開始と終了を記録 | |
setopt EXTENDED_HISTORY | |
# pyenv | |
#export PYENV_ROOT=$HOME/.pyenv | |
#export PATH=$PYENV_ROOT/bin:$PATH | |
#eval "$(pyenv init -)" | |
export WORKON_HOME=$HOME/.virtualenvs | |
export PROJECT_HOME=$HOME/Devel | |
#source /path/to/your/virtualenvwrapper.sh | |
# path | |
export EDITOR=/usr/bin/vim | |
# derved | |
alias derivePath="cd ~/Library/Developer/Xcode/DerivedData" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment