-
Notifications
You must be signed in to change notification settings - Fork 7
/
zshrc
191 lines (161 loc) · 4.4 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
# env
export LANG=en_CA.UTF-8
export EDITOR="nvim"
export PAGER="less"
export GOPATH="$HOME/Documents/go"
export FZF_DEFAULT_COMMAND="fd --type f --hidden --follow --exclude .git --exclude '*~'"
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
export fpath=("$HOME/.zfuntions", $fpath)
export XDG_DATA_HOME="$HOME/.local/share"
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_CACHE_HOME="$HOME/.cache"
# zsh options
autoload -Uz colors && colors
autoload -Uz compinit && compinit
export extended_history
setopt hist_ignore_dups
setopt hist_ignore_space
setopt hist_verify
setopt inc_append_history
setopt share_history
setopt hist_ignore_all_dups
setopt hist_no_store
setopt hist_ignore_space
export HISTSIZE=100000
export SAVEHIST=$HISTSIZE
export HISTFILE=~/.zsh_history
setopt auto_pushd
setopt extended_glob
setopt no_beep
setopt complete_aliases
setopt no_clobber
setopt short_loops
setopt check_jobs
setopt notify
setopt auto_menu
setopt autolist
setopt list_types
setopt no_list_ambiguous
setopt no_auto_remove_slash
setopt auto_param_keys
setopt prompt_subst
# normal bright
# black 0 8
# red 1 9
# green 2 10
# yellow 3 11
# blue 4 12
# magenta 5 13
# cyan 6 14
# white 7 15
autoload -Uz vcs_info
zstyle ':vcs_info:*' formats '%F{8} %F{7}%b%f'
zstyle ':vcs_info:*' actionformats '%F{8} %F{7}%b|%a%f'
function prompt() {
PCOLOR="%F{15}"
PSYMBOLGOOD="•"
PSYMBOLBAD="✗"
if [[ -f "$HOME/.zsh.prompt" ]]; then
source ~/.zsh.prompt
fi
local PROMPT=''
# status of last command
PROMPT+="%(0?.${PCOLOR}${PSYMBOLGOOD}.%B%F{1}${PSYMBOLBAD}%b)%f"
# root
PROMPT+="%(!.%F{1} root%f.)"
# hostname
PROMPT+=" ${PCOLOR}%m%f "
# pwd
PROMPT+="%F{12}%(4~|%-1~/…/%2~|%~)%f"
# git
PROMPT+="${vcs_info_msg_0_}"
if [[ -n "$(git status --porcelain 2>/dev/null)" ]]; then
PROMPT+="%F{1}*%f"
fi
# end
PROMPT+=" %F{13}❯%f "
echo "$PROMPT"
}
precmd () { vcs_info }
export PS1='$(prompt)'
# keybinds
bindkey -e
bindkey '\e[H' beginning-of-line
bindkey '\e[F' end-of-line
bindkey '\e[5~' history-beginning-search-backward
bindkey '\e[6~' history-beginning-search-forward
bindkey '\e[1;3D' emacs-backward-word
bindkey '\e[1;3C' emacs-forward-word
bindkey '\e[3~' delete-char
bindkey '\e[3;3~' delete-word
bindkey -s '\e[' '\\\C-v['
bindkey '\e[1~' beginning-of-line
bindkey '\e[4~' end-of-line
export WORDCHARS="${WORDCHARS/\/}"
if [[ `uname` == 'Darwin' ]]; then
local gnubin="/usr/local/opt/coreutils/libexec/gnubin"
local findbin="/usr/local/opt/findutils/libexec/gnubin"
if [[ -d $gnubin ]]; then
export PATH="${gnubin}:$PATH"
fi
if [[ -d $findbin ]]; then
export PATH="${findbin}:$PATH"
fi
export PATH="/usr/local/bin:$PATH"
fi
export PATH="$HOME/.bin:$PATH"
typeset -aU path
if [[ `ls --color=auto 2>/dev/null` ]]; then
if [[ ! -z "${WSL_DISTRO_NAME}" ]]; then
alias ls="LC_COLLATE=POSIX ls --group-directories-first --color=auto 2>/dev/null"
else
alias ls="LC_COLLATE=POSIX ls --group-directories-first --color=auto"
fi
alias ll="ls -lh"
alias la="la -a"
fi
if type fdfind &>/dev/null && ! type fd &>/dev/null; then
alias fd=fdfind
fi
if [[ $(command dircolors) && -f "$HOME/.dir_colors" ]]; then
eval $(dircolors "$HOME/.dir_colors")
fi
# must go at end of file
source ~/.zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.plugin.zsh
# auto-generated stuff
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
if type nvim > /dev/null; then
alias vim=nvim
fi
if [ -d "$HOME/.pyenv" ]; then
export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
if [ -f "$(pyenv root)/completions/pyenv.zsh" ]; then
source "$(pyenv root)/completions/pyenv.zsh"
fi
fi
if type jenv > /dev/null; then
eval "$(jenv init -)"
fi
if type rbenv > /dev/null; then
eval "$(rbenv init -)"
fi
# fkill - kill process
fkill() {
local pid
pid=$(ps -ef | sed 1d | fzf -m | awk '{print $2}')
if [ "x$pid" != "x" ]
then
echo $pid | xargs kill -${1:-9}
fi
}
if [[ -f "$HOME/.aliases" ]]; then
source "$HOME/.aliases"
fi
# export GDK_SCALE=2
# export GDK_DPI_SCALE=0.5
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion