-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathzshrc
169 lines (141 loc) · 3.66 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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# Path to your oh-my-zsh installation.
export ZSH=$HOME/.oh-my-zsh
# Look in ~/.oh-my-zsh/themes/
ZSH_THEME="muse"
# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"
# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# The optional three formats: "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# HIST_STAMPS="mm/dd/yyyy"
setopt HIST_EXPIRE_DUPS_FIRST
setopt HIST_IGNORE_ALL_DUPS
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
plugins=(
brew
colored-man-pages
docker
git
github
git-flow
gradle
# jira
httpie
pip
ssh-agent
taskwarrior
thefuck # Esc x2 to correct previous command
tmux
vagrant
# zsh-syntax-highlighting
)
source $ZSH/oh-my-zsh.sh
# User configuration
export TERM=screen-256color
export GOPATH="/usr/local/Cellar/go/1.3.1/"
# You may need to manually set your language environment
# export LANG=en_US.UTF-8
# Preferred editor for local and remote sessions
if [[ -n $SSH_CONNECTION ]]; then
export EDITOR='vim'
else
export EDITOR='vim'
fi
# ssh
export SSH_KEY_PATH="~/.ssh/rsa_id"
alias cp='cp -i'
alias mv='mv -i'
alias rm='rm -i'
alias rmbk='find . -name "*.pyc" -delete'
alias sl='sl -aF'
alias pbj='pbpaste | jq --sort-keys .'
alias pbjc='pbpaste | jq --sort-keys . | pbcopy'
alias jq='jq --sort-keys'
alias gcoi='gco $(git branch | fzf --height=20% --layout=reverse --border)'
alias gcod='gco develop'
alias gcom='gco master &> /dev/null || gco main'
alias gst='git status -sb'
alias ghprv="gh pr view --web"
alias tmux='tmux -2' # Colours!
alias sz='source ~/.zshrc'
alias vz='vim ~/.zshrc'
alias vzl='vim ~/.zshrc.local'
alias vt='vim ~/.tmux.conf'
alias vv='vim ~/.vimrc'
# Setting for the new UTF-8 terminal support in Lion
LC_CTYPE=en_US.UTF-8
LC_ALL=en_US.UTF-8
gdone() {
branch=$(git symbolic-ref --short HEAD)
gcom
git pull
# gcod
# git pull
gb -d $branch
git remote prune origin
}
# Make sure fzf uses ag so git/svn/hg ignores are taken into account
export FZF_DEFAULT_COMMAND='rg -g ""' # Default use case
export FZF_CTRL_T_COMMAND=$FZF_DEFAULT_COMMAND # CTRL+T shortcut
_fzf_compgen_path() { # ** completion
ag -g "" "$1"
}
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
# run to specified command
# zsh completion in ~/.oh-my-zsh/completions/_runto
runto() {
if [ "$#" -ne 1 ]
then
echo "You need to specify where to run to"
return
fi
local file=~/.runto/$1.sh
if [[ -r ${file} ]]
then
echo "Running to $1!"
. $file
else
echo "Cannot run to $1, not found!"
fi
}
count() {
if [ "$#" -ne 1 ]
then
echo "You need to specify a location"
return
fi
if [[ -d $1 ]]
then
ls $1 | wc -l
else
echo "Path not found"
fi
}
[ -f /usr/local/etc/profile.d/z.sh ] && source /usr/local/etc/profile.d/z.sh
if [[ `ssh-add -l` != *id_rsa* ]]
then
echo "Adding ssh key to ssh-agent"
ssh-add --apple-use-keychain ~/.ssh/id_ed25519
fi
eval $(thefuck --alias)
export ZSH_HIGHLIGHT_HIGHLIGHTERS_DIR=/usr/local/share/zsh-syntax-highlighting/highlighters
# Pet - CLI snippet manager (https://github.com/knqyf263/pet)
# Shortcut to search
function pet-select() {
BUFFER=$(pet search --query "$LBUFFER" --color)
CURSOR=$#BUFFER
zle redisplay
}
zle -N pet-select
stty -ixon
bindkey '^n' pet-select
# Function to register previous command
function pet-remember() {
PREV=$(fc -lrn | head -n 1)
sh -c "pet new -t `printf %q "$PREV"`"
}
[ -f ~/.zshrc.secrets ] && source ~/.zshrc.secrets
[ -f ~/.zshrc.local ] && source ~/.zshrc.local
[ -f ~/.zshrc.fun ] && source ~/.zshrc.fun