-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.zshrc
144 lines (105 loc) · 3.5 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
# Oh My Zsh {{{
ZSH=$HOME/.oh-my-zsh
# source aliases from ~/.zsh_aliases
source ~/.zsh_aliases
# source functions from ~/.zsh_functions
source ~/.zsh_functions
# use sane history stamps
HIST_STAMPS="yyyy-mm-dd"
# use oh-my-zsh and some of its plugins
plugins=(git)
source $ZSH/oh-my-zsh.sh
# don't AUTO_CD, 'cuz it's lame
unsetopt AUTO_CD
# }}}
# Prompt {{{
# define prompt expansions
PROMPT='[%*]$(venv_info) %F{cyan}%n@%m%f:%F{green}%~%f$(git_prompt_info) § '
NORMAL_PROMPT="${PROMPT}"
VI_PROMPT=${PROMPT/'§'/'%{%F{125}%}§%f'}
ZSH_THEME_VENV_PROMPT_PREFIX=" %F{105}venv:("
ZSH_THEME_VENV_PROMPT_SUFFIX=")%f"
ZSH_THEME_GIT_PROMPT_PREFIX=" %F{yellow}git:("
ZSH_THEME_GIT_PROMPT_SUFFIX=")%f"
# }}}
# Environment Variables {{{
# all your binaries are belong to my PATH
export PATH="/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:$HOME/.local/bin"
# set preferred EDITOR to vim
export EDITOR='vim'
# use bat to color man pages (https://git.io/JTnWJ)
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
export MANROFFOPT="-c"
# use gruvbox as the bat theme
export BAT_THEME='gruvbox-dark'
# keep it secret, keep it safe https://j.mp/1Mrj1op
source $HOME/.secrets
# }}}
# Language-Specific Configuration {{{
# make Go go
export GOROOT="$HOME/.local/go"
export GOPATH="$HOME/Projects/go"
export PATH="$PATH:$GOROOT/bin:$GOPATH/bin"
# make Rust rusty
source "$HOME/.cargo/env"
# use a Python startup file
export PYTHONSTARTUP="${HOME}/.pythonrc"
# make poetry poetic
export PATH="$HOME/.poetry/bin:$PATH"
# use pyenv to manage Python installations
export PYENV_ROOT="${HOME}/.pyenv"
export PATH="${PYENV_ROOT}/bin:${PATH}"
# enable pyenv shims and autocompletion
if command -v pyenv 1>/dev/null 2>&1
then
eval "$(pyenv init --path)"
eval "$(pyenv init -)"
fi
# make virtualenvwrapper work
export VIRTUALENVWRAPPER_PYTHON="$(pyenv which python3)"
export WORKON_HOME="$HOME/.virtualenvs"
source $(pyenv which virtualenvwrapper.sh)
# make volta electric
export VOLTA_HOME="$HOME/.volta"
[ -s "$VOLTA_HOME/load.sh" ] && . "$VOLTA_HOME/load.sh"
export PATH="$VOLTA_HOME/bin:$PATH"
# keep dotnet in line
export DOTNET_CLI_TELEMETRY_OPTOUT=1
# }}}
# Line Editing {{{
# An enormous thank you to Doug Black for their excellent vi-mode blog post!
# https://dougblack.io/words/zsh-vi-mode.html
# use vi-mode for line editing
bindkey -v
# use ctrl-p and ctrl-n to cycle history
bindkey '^P' up-history
bindkey '^N' down-history
# use hjkl to navigate tab completion
bindkey -M menuselect 'h' vi-backward-char
bindkey -M menuselect 'k' vi-up-line-or-history
bindkey -M menuselect 'l' vi-forward-char
bindkey -M menuselect 'j' vi-down-line-or-history
# retain shift-tab as reverse menu completion
bindkey -M menuselect '^[[Z' reverse-menu-complete
# make backspace and ctrl-h work even after returning from command mode
bindkey '^?' backward-delete-char
bindkey '^h' backward-delete-char
# use ctrl-w to remove words backwards
bindkey '^w' backward-kill-word
# use ctrl-r for reverse history search
bindkey '^r' history-incremental-search-backward
# use ctrl-e to edit the current line in the default $EDITOR
autoload edit-command-line
zle -N edit-command-line
bindkey '^e' edit-command-line
# switch between normal and vi-mode prompt when changing keymaps
function zle-line-init zle-keymap-select {
PROMPT="${${KEYMAP/vicmd/$VI_PROMPT}/(main|viins)/${NORMAL_PROMPT}}"
zle reset-prompt
}
zle -N zle-line-init
zle -N zle-keymap-select
# use a mode change delay of 0.1s
export KEYTIMEOUT=1
# }}}
# vim:foldmethod=marker:foldlevel=0