forked from onk/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.zshrc
114 lines (97 loc) · 2.59 KB
/
.zshrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
autoload -Uz compinit
autoload -Uz promptinit
autoload -Uz vcs_info
compinit
promptinit
# history
HISTFILE=$HOME/.zsh-history
HISTSIZE=1000000
SAVEHIST=1000000
setopt EXTENDED_HISTORY
setopt SHARE_HISTORY
setopt NO_BANG_HIST
function history-all { history -E 1 }
REPORTTIME=3
export CDPATH=$HOME
setopt AUTO_CD
setopt AUTO_PUSHD
setopt PUSHD_IGNORE_DUPS
WORDCHARS='*?-.[]~&;!#$%^(){}<>'
# prompt
if [ -f ~/.zsh/my_prompt.zsh ]; then
source ~/.zsh/my_prompt.zsh
fi
# completion
zstyle ':completion:*:default' menu select
setopt list_packed
# C-S, C-Q によるフロー制御を使わない
setopt NO_FLOW_CONTROL
alias -g RD='RAILS_ENV=development'
alias -g RT='RAILS_ENV=test'
alias -g RP='RAILS_ENV=production'
alias -g CSU='| cut -d":" -f1 | sort | uniq'
alias rm="gomi"
alias g="git"
alias s="git status -sb"
alias r="bundle exec rails"
alias :q="exit"
alias sb="SOCKS_PROXY=localhost:1080 bundle-socks"
alias sr="SOCKS_PROXY=localhost:1080 bundle-socks exec rails"
alias bi="bundle install --path ~/.bundle --binstubs=~/.bundle/bin --without= --jobs=4"
alias sbi="SOCKS_PROXY=localhost:1080 bundle-socks install --path ~/.bundle --binstubs=~/.bundle/bin --without= --jobs=4"
alias cod="git checkout develop"
alias com="git checkout master"
alias cow="git checkout working"
function v() {vi -p ${${=*/:/ +}/:*}}
case "${OSTYPE}" in
darwin*)
alias ll='ls -lFG'
alias lsd='ls -lFG | grep -e "^d" --color=never'
;;
linux*)
alias ll='ls -lvF --color'
alias lsd='ls -lvF --color | grep -e "^d" --color=never'
;;
esac
# cd したら ls
function chpwd() {
case "${OSTYPE}" in
darwin*)
ls -lF -G
;;
linux*)
ls -lvF --color
;;
esac
}
# chruby
source /usr/local/share/chruby/chruby.sh
chruby 2.3.0-dev
# gopath
if [ -z "${GOPATH:-}" ]; then
export GOPATH=$HOME/go
PATH=$PATH:$GOPATH/bin
fi
# peco
if [ -f ~/.zsh/my_peco.zsh ]; then
source ~/.zsh/my_peco.zsh
fi
# zsh-bd
if [ -f ~/.zsh/plugins/bd/bd.zsh ]; then
source ~/.zsh/plugins/bd/bd.zsh
fi
# http://ukstudio.jp/2015/03/26/open_pull_request/
function find-pr() {
local parent=$2||'master'
git log $1..$2 --merges --ancestry-path --reverse --oneline | head -n1
}
function find-pr-open() {
local pr="$(find-pr $1 $2 | awk '{print substr($5, 2)}')"
local repo="$(git config --get remote.origin.url | sed 's#ssh://git@#https://#' | sed 's/\.git$//')"
open "${repo}/pull/${pr}"
}
function find-mr-open() {
local pr="$(find-pr $1 $2 | awk '{print substr($7, 2)}')"
local repo="$(git config --get remote.origin.url | sed 's#ssh://git@#http://#' | sed 's/\.git$//')"
open "${repo}/merge_requests/${pr}"
}