-
Notifications
You must be signed in to change notification settings - Fork 0
/
zshrc
167 lines (133 loc) · 5.88 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
# If you come from bash you might have to change your $PATH.
export PATH="$HOME/.local/bin:$HOME/bin:$PATH"
########################## oh-my-zsh options #########################
# Case-sensitive completion must be off. _ and - will be interchangeable.
HYPHEN_INSENSITIVE=true
# Disable oh-my-zsh tab title, enable only directory name
DISABLE_AUTO_TITLE=true
ZSH_TAB_TITLE_ONLY_FOLDER=true
ZSH_TAB_TITLE_CONCAT_FOLDER_PROCESS=true
######################## end oh-my-zsh options #######################
######################## zgenom plugin manager #######################
# Look for changes to zsh config and auto reload plugins
ZGEN_RESET_ON_CHANGE=(${HOME}/.zshrc ${HOME}/.zshrc.local $([[ -f ${HOME}/.zshrc.macos ]] && echo ${HOME}/.zshrc.macos))
# Fuzzy fast jump
FZ_HISTORY_CD_CMD=zshz
# Disable forgit aliases
export FORGIT_NO_ALIASES=true
# enable iTerm2 shell integrations
zstyle :omz:plugins:iterm2 shell-integration yes
# Lazy load nvm
zstyle :omz:plugins:nvm lazy yes
# Load zgenom plugin manager
source "${HOME}/.zgenom/zgenom.zsh"
# Update plugins every 7 days, didable oh-my-zsh updates
zgenom autoupdate
# If the init script doesn't exist, create it
if ! zgenom saved; then
# Plugins
zgenom oh-my-zsh
zgenom oh-my-zsh plugins/brew # brew env and completions
zgenom oh-my-zsh plugins/git
zgenom oh-my-zsh plugins/python
zgenom oh-my-zsh plugins/sudo # double press escape to prepend sudo
zgenom oh-my-zsh plugins/vundle
zgenom oh-my-zsh plugins/urltools
if hash tmux &>/dev/null; then
zgenom oh-my-zsh plugins/tmux
fi
zgenom oh-my-zsh plugins/copypath
zgenom oh-my-zsh plugins/colored-man-pages
zgenom oh-my-zsh plugins/nvm
# iTerm2 shell integration and utilities
if [[ "$(uname -s)" = Darwin ]]; then
zgenom oh-my-zsh plugins/iterm2
zgenom bin gnachman/iTerm2-shell-integration --location utilities
fi
zgenom load agkozak/zsh-z # fast jump
zgenom load changyuheng/fz # fuzzy fast jump completion
zgenom load wfxr/forgit # fzf + git
zgenom bin wfxr/forgit # add forgit command to git
zgenom load valentinocossar/vscode # aliases for Visual Studio Code
zgenom load supercrabtree/k # Better ls with git status
zgenom load zsh-users/zsh-completions src # More completions
zgenom load zsh-users/zsh-autosuggestions # Fish-like fast autosuggestions
zgenom load zdharma-continuum/fast-syntax-highlighting # Better syntax highlighting
zgenom load trystan2k/zsh-tab-title # Update tab title
zgenom load romkatv/zsh-no-ps2 # Disable PS2 for easier editing
# Theme
zgenom load woefe/git-prompt.zsh
# Generate the init script from plugins above
zgenom save
zgenom compile "$HOME/.zshrc"
[[ -f $HOME/.zshrc.local ]] && zgenom compile "$HOME/.zshrc.local"
[[ $OSTYPE == darwin* ]] && zgenom compile "$HOME/.zshrc.macos"
fi
###################### end zgenom plugin manager #####################
############################### Prompt ###############################
# Prevent Python virtualenv from modifying the prompt
export VIRTUAL_ENV_DISABLE_PROMPT=1
# Set $psvar[12] to the current Python virtualenv
function _prompt_update_venv() {
psvar[12]=
if [[ -n $VIRTUAL_ENV ]] && [[ -n $VIRTUAL_ENV_DISABLE_PROMPT ]]; then
psvar[12]="${VIRTUAL_ENV:t}"
fi
}
add-zsh-hook precmd _prompt_update_venv
# Git prompt settings
ZSH_GIT_PROMPT_FORCE_BLANK=1 # don't cache git status
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[default]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX=""
ZSH_THEME_GIT_PROMPT_SEPARATOR=" "
ZSH_THEME_GIT_PROMPT_DETACHED="%{$fg_no_bold[cyan]%}:"
ZSH_THEME_GIT_PROMPT_BRANCH="%{$fg_bold[white]%}"
ZSH_THEME_GIT_PROMPT_BEHIND="%{$fg_no_bold[cyan]%}↓"
ZSH_THEME_GIT_PROMPT_AHEAD="%{$fg_no_bold[cyan]%}↑"
ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[red]%}✖"
ZSH_THEME_GIT_PROMPT_STAGED="%{$fg[green]%}•"
ZSH_THEME_GIT_PROMPT_UNSTAGED="%{$fg[yellow]%}✚"
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[red]%}⋯"
ZSH_THEME_GIT_PROMPT_STASHED="%{$fg[blue]%}⚑"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg_bold[green]%}✔"
# Prompt settings
PROMPT=$'%F{7}┏╸%f' # start prompt symbol
PROMPT+=$'%F{12}%n@%m%f %B%~%b' # user@hostname current-dir
PROMPT+='%(12V.%F{8} (%12v)%f .)' # Python virtualenv name
PROMPT+=$'\n%F{7}┗╸%f' # newline, other prompt symbol
PROMPT+=$'%(?.%F{blue}❯%f%F{cyan}❯%f%F{10}❯%f.%F{red}❯❯❯%f) '
RPROMPT=$'$(gitprompt)' # async git on right prompt
PS2=$'%F{7}╺╸❯❯❯%f ' # match PS1 arrows for PS2
############################# End Prompt #############################
# Language environment
export LANG=en_US.UTF-8
export LESS="-RI --tabs=4 --use-color"
# macOS specific config
[[ $OSTYPE == darwin* ]] && source $HOME/.zshrc.macos
# Local config
[[ -f $HOME/.zshrc.local ]] && source $HOME/.zshrc.local
# Forgit settings
export FORGIT_FZF_DEFAULT_OPTS="--height '100%'"
export FORGIT_LOG_GRAPH_ENABLE=false
export FORGIT_BLAME_GIT_OPTS="--date iso"
if type delta > /dev/null; then
export DELTA_PAGER="less"
fi
if type bat > /dev/null; then
export BAT_PAGER="less -F"
export BAT_THEME="Monokai Extended Bright"
fi
# Show user readable file sizes by default
if type k > /dev/null; then
alias k="k -h"
fi
# VSCode shortcut
alias code="vs"
# Make sure git is setup
if [[ ! $(git config user.email) ]] || [[ ! $(git config user.name) ]]; then
echo "\e[31m~/.gitconfig.local IS NOT CONFIGURED!!\e[0m"
fi
# Python pretty print by default in REPL
export PYTHONSTARTUP="$HOME/.pythonstartup"
# set git commit -m highlighting to 72
FAST_HIGHLIGHT[git-cmsg-len]=72