-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.zshrc
210 lines (174 loc) · 5.56 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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
#!/usr/bin/env zsh
autoload -Uz zmv
autoload -Uz compinit && compinit
zstyle ':completion:*' menu select
zstyle ':completion:*' matcher-list 'm:{a-zA-Z-_}={A-Za-z_-}' 'r:|=*' 'l:|=* r:|=*'
# Finally, make sure the terminal is in application mode, when zle is
# active. Only then are the values from $terminfo valid.
if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then
function zle-line-init () {
echoti smkx
}
function zle-line-finish () {
echoti rmkx
}
zle -N zle-line-init
zle -N zle-line-finish
fi
## Key bindings
bindkey -e
# / is not a part of word, allows ctrl+w to delete paths up till /
WORDCHARS=''
source /usr/share/doc/find-the-command/ftc.zsh
# History settings
HISTFILE=~/.history
HISTSIZE=10000
SAVEHIST=10000
setopt inc_append_history
setopt extended_history
setopt hist_ignore_all_dups
setopt hist_reduce_blanks
setopt hist_no_store
setopt hist_no_functions
unsetopt hist_verify
# MISC zsh settings
setopt auto_cd
setopt multios
unsetopt correctall
# Named directories
dotfiles=~/git/dotfiles
charon=~/git/src/github.com/ygt/charon
spin=~/git/spin
frontend=~/git/frontend
puppet=~/git/puppet
sales=~/git/sales
spabreaks=~/git/spabreaks
qs=~/git/sb-query-server
redemptions=~/git/sb-voucher-redemptions
canting=~/git/canting
media=/home/media
# : ~dotfiles ~charon ~spin ~frontend ~puppet ~redemptions ~sales ~spabreaks ~media ~canting
# Prompts
autoload -Uz colors && colors
autoload -Uz vcs_info
setopt prompt_subst
zstyle ':vcs_info:*' enable git
zstyle ':vcs_info:*' check-for-changes true
zstyle ':vcs_info:git*+set-message:*' hooks git-untracked
zstyle ':vcs_info:git*' formats "%{$reset_color%} at %{$fg[blue]%}%b%{$reset_color%} %{$fg[green]%}%c%u"
function +vi-git-untracked() {
if [[ $(git rev-parse --is-inside-work-tree 2> /dev/null) == 'true' ]] && \
git status --porcelain | grep '??' &> /dev/null ; then hook_com[unstaged]+="+"
fi
}
precmd() {
vcs_info
}
export PROMPT='%B%(?..[%?] )%b%n@%U%m%u in %{$fg[yellow]%}%1~${vcs_info_msg_0_}%{$reset_color%}> '
export RPROMPT="%F{yellow}%~%f"
# PATH
typeset -U path
path=(~/.node_modules/bin
/usr/bin/vendor_perl
~/.rbenv/bin
~/scripts
~/.local/bin
$path)
# Export section
export EDITOR=nvim
export SHELL=/bin/zsh
# export PAGER=nvimpager
export GOPATH=~/git
export RUBY_GC_MALLOC_LIMIT=90000000
export RUBY_GC_HEAP_FREE_SLOTS=200000
# export FZF_DEAFULT_COMMAND='fd --type f --hidden --follow --exclude .git'
export FZF_DEFAULT_COMMAND='fd --type f --strip-cwd-prefix'
export COMPOSE_DOCKER_CLI_BUILD=1
export DOCKER_BUILDKIT=1
export USE_GKE_GCLOUD_AUTH_PLUGIN=True
export MOZ_ENABLE_WAYLAND=1
# Start qiv with: fulscreen, atorotate, scaling large images down and no status bar.
alias qiv='qiv -f -l -t -i $1'
# Keychain activation.
eval $(keychain --inherit any-once --eval --quiet --noask id_ed25519)
# Initialize rbenv
eval "$(rbenv init -)"
# Aliases for different ls commands
alias ls='ls --color=auto'
alias ll='ls -l'
alias l='exa -ahl'
# Some aliases
# alias sudo='sudo -E'
alias vi=vim
alias md='mkdir -p'
alias psack='ps aux | rg $1'
alias expack='export | rg $1'
alias lack='l | rg $1'
alias nara="sudo shutdown -hP now"
alias vim=nvim
alias task=go-task
# Git aliases
alias g='git'
alias ga='git add'
alias gb='git branch'
alias gc='git commit -v'
alias gco='git checkout'
alias gd='git diff'
alias gdca='git diff --cached'
alias gdne='git diff --no-ext-diff'
alias gl='git pull'
alias glog='git log --oneline --decorate --graph'
alias gp='git push -u'
function grec() {
git branch --sort=-committerdate | head -n "${1:-10}"
}
alias grhh="git reset --hard HEAD"
alias gst='git status'
alias gsta='git stash save'
alias gstp='git stash pop'
function github_pr_title() {
IFS=- read jira1 jira2 branch <<< "$(git symbolic-ref --short HEAD)"
echo "[${jira1}-${jira2}] $(echo $branch | tr '-' ' ')"
}
function gom() {
vim $(git status --porcelain | awk '{print $2}')
}
alias rs='bin/rails s'
alias rc='bin/rails c'
alias dco='docker-compose'
alias nvm-init='source /usr/share/nvm/init-nvm.sh && nvm use'
alias k='kubectl'
function mkcd {
[[ -n "$1" ]] && mkdir -p "$1" && builtin cd "$1"
}
function docker-clean {
docker rm -v $(docker ps --filter status=exited -q 2>/dev/null) 2>/dev/null
docker rmi $(docker images --filter dangling=true -q 2>/dev/null) 2>/dev/null
}
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
[ -f ~/k/k.sh ] && source ~/k/k.sh
# added by travis gem
[ -f /home/gat/.travis/travis.sh ] && source /home/gat/.travis/travis.sh
source '/usr/share/zsh/site-functions/_gcloud'
# The next line updates PATH for the Google Cloud SDK.
if [ -f /home/gat/git/spabreaks/google-cloud-sdk/path.zsh.inc ]; then
source '/home/gat/git/spabreaks/google-cloud-sdk/path.zsh.inc'
fi
# The next line enables shell command completion for gcloud.
if [ -f /home/gat/git/spabreaks/google-cloud-sdk/completion.zsh.inc ]; then
source '/home/gat/git/spabreaks/google-cloud-sdk/completion.zsh.inc'
fi
# Source pazi
if command -v pazi &>/dev/null; then
eval "$(pazi init zsh)"
fi
export PATH="$HOME/.yarn/bin:$PATH"
source /usr/share/zsh-theme-powerlevel10k/powerlevel10k.zsh-theme
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh