-
Notifications
You must be signed in to change notification settings - Fork 0
/
.zshrc
150 lines (123 loc) · 3.86 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
# 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
# Colors!
export TERM="xterm-256color"
export LANG='en_US.UTF-8'
# Path to oh-my-zsh
export ZSH=~/.oh-my-zsh
DEFAULT_USER=$USER
# https://github.com/romkatv/powerlevel10k + https://github.com/AravSinghal/ConsolasForPowerline
ZSH_THEME="powerlevel10k/powerlevel10k"
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
ZLE_RPROMPT_INDENT=0
POWERLEVEL9K_LEGACY_ICON_SPACING=true
# Allow emacs to track the current directory
if [ -n "$INSIDE_EMACS" ]; then
chpwd() { print -P "\033AnSiTc %d" }
print -P "\033AnSiTu %n"
print -P "\033AnSiTc %d"
POWERLEVEL9K_MODE='flat'
POWERLEVEL9K_TIME_FOREGROUND="black"
POWERLEVEL9K_TIME_BACKGROUND="white"
POWERLEVEL9K_STATUS_ERROR_FOREGROUND="white"
POWERLEVEL9K_STATUS_ERROR_BACKGROUND="red"
POWERLEVEL9K_STATUS_OK_FOREGROUND="white"
POWERLEVEL9K_STATUS_OK_BACKGROUND="green"
POWERLEVEL9K_NODE_VERSION_FOREGROUND="white"
POWERLEVEL9K_NODE_VERSION_BACKGROUND="blue"
POWERLEVEL9K_LEFT_SEGMENT_SEPARATOR=''
POWERLEVEL9K_RIGHT_SEGMENT_SEPARATOR=''
POWERLEVEL9K_CUSTOM_FIX_EMACS_BACKGROUND="green"
POWERLEVEL9K_CUSTOM_FIX_EMACS_FOREGROUND="white"
fi
# _ and - will be interchangeable.
HYPHEN_INSENSITIVE="true"
# Prevent the update prompt
DISABLE_UPDATE_PROMPT=true
# Disable bi-weekly auto-update checks.
DISABLE_AUTO_UPDATE="true"
# Disable auto-setting terminal title.
DISABLE_AUTO_TITLE="true"
# Enable command auto-correction.
ENABLE_CORRECTION="false"
# Display red dots whilst waiting for completion.
COMPLETION_WAITING_DOTS="true"
# pyenv
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init --path)"
# Plugins!
plugins=(
alias-finder
aliases
common-aliases
debian
docker
extract
git
gh
github
golang
npm
pip
pyenv
python
safe-paste
ssh-agent
sudo
web-search
ufw
nvm
)
# ssh agent setup
zstyle :omz:plugins:ssh-agent identities `find ~/.ssh/ -type f ! -name "*.pub" ! -name "known_hosts" ! -name "config" ! -name "*.ppk" ! -name "environment-laptop" ! -name "environment-pc" -printf "%f\n"`
source $ZSH/oh-my-zsh.sh
# ctrl + backspace = delete word (backward)
bindkey '^H' backward-kill-word
# ctrl + delete = delete word (forward)
bindkey '^[[3;5~' kill-word
# language environment
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
export LC_CTYPE="en_US.UTF-8"
# Preferred editor for local and remote sessions
if [[ -n $SSH_CONNECTION ]]; then
export EDITOR='emacs -nw'
else
export EDITOR='/usr/bin/emacsclient --alternate-editor emacs'
export VISUAL='/usr/bin/emacsclient --alternate-editor emacs'
fi
# Aliases
alias e="/usr/bin/emacsclient -n --alternate-editor emacs"
alias configemacs="e ~/.emacs.d/init.el"
alias configzsh="e ~/.zshrc"
alias configohmyzsh="e ~/.oh-my-zsh"
alias configi3="e ~/.i3"
alias configssh="e ~/.ssh/config"
alias dotfiles='/usr/bin/git --git-dir=/home/$USER/dotfiles/ --work-tree=/home/$USER'
alias cls="clear"
alias ducks="du -hcs -BM * | sort -rn | head"
alias grbim='git rebase -i origin/master'
alias qrcode='qrencode -o - -t UTF8'
# dotfiles alias auto-completion
complete -F _complete_alias dotfiles
compdef dotfiles='git'
setopt complete_aliases
# Functions
# bc - An arbitrary precision calculator language
# Ripped off from https://github.com/arzzen/calc.plugin.zsh
function =
{
echo "$@" | bc -l
}
alias calc="="
# Path
path+=("/home/$USER/.local/bin")
path+=("/usr/local/go/bin")
path+=("/home/$USER/go/bin")
path+=("/var/lib/flatpak/exports/bin")
fpath+=${ZDOTDIR:-~}/.zsh_functions