-
Notifications
You must be signed in to change notification settings - Fork 0
/
.zshrc
157 lines (127 loc) · 2.85 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
# Start GUI
if [ -z "${DISPLAY}" ] && [ -z "${WAYLAND_DISPLAY}" ] && [ "${XDG_VTNR}" -eq 1 ]; then
# exec systemd-cat --identifier=hyprland Hyprland
# exec systemd-cat --identifier=sway sway
exec systemd-cat --identifier=awesome startx /usr/bin/awesome
fi
# GPG Signing Key for GitHub
export GPG_TTY=$(tty)
# Completions
FILE="/usr/share/zsh/site-functions"
if [ -f "$FILE" ]; then
fpath=("$FILE" $fpath)
fi
zstyle :compinstall filename "$HOME/.zshrc"
autoload -Uz compinit
compinit
# History
HISTFILE="$HOME/.history"
HISTSIZE=10000
SAVEHIST=10000
# Fix directory colors
FILE="$HOME/.config/dircolors"
if [ -f "$FILE" ]; then
eval "$(dircolors -b $FILE)"
fi
# Enable local bin
FILE="$HOME/.local/bin"
if [ -d "$FILE" ]; then
PATH="$FILE:$PATH"
fi
# Enable go bin
FILE="$HOME/go/bin"
if [ -d "$FILE" ]; then
PATH="$FILE:$PATH"
fi
# Arch specific
if (($+commands[pacdiff])); then
export DIFFPROG="nvim -d"
fi
# Better history searching
if (($+commands[fzf])); then
FILE="/usr/share/fzf/completions.zsh"
if [ -f "$FILE" ]; then
source "$FILE"
fi
FILE="/usr/share/fzf/key-bindings.zsh"
if [ -f "$FILE" ]; then
source "$FILE"
fi
fi
# Autosuggestions
FILE="/usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh"
if [ -f "$FILE" ]; then
source "$FILE"
fi
# Syntax highlighting
FILE="/usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
if [ -f "$FILE" ]; then
source "$FILE"
fi
# Vim mode
if (($+commands[nvim])); then
bindkey -v
export EDITOR=nvim
alias vim="nvim"
fi
# Better ls
if (($+commands[lsd])); then
if [ "$DISPLAY" ]; then
alias ls="lsd"
else
alias ls="lsd --icon never"
fi
fi
alias ll="ls -l"
alias lla="ll -a"
# Better cat
if (($+commands[bat])); then
alias cat="bat --plain --theme ansi"
fi
# Better find
if (($+commands[fd])); then
alias find="fd"
fi
# Better grep
if (($+commands[rg])); then
alias grep="rg"
fi
# Fast directory switching
if (($+commands[zoxide])); then
eval "$(zoxide init zsh)"
fi
# ASDF
FILE="$HOME/.asdf/asdf.sh"
if [ -f "$FILE" ]; then
. "$HOME/.asdf/asdf.sh"
# append completions to fpath
fpath=(${ASDF_DIR}/completions $fpath)
# initialise completions with ZSH's compinit
autoload -Uz compinit && compinit
fi
# Rust
FILE="$HOME/.cargo/env"
if [ -f "$FILE" ]; then
. "$HOME/.cargo/env"
if [ ! -d "$HOME/.zfunc" ]; then
mkdir -p "$HOME/.zfunc"
fi
if [ ! -f "$HOME/.zfunc/_cargo" ]; then
rustup completions zsh cargo > "$HOME/.zfunc/_cargo"
fi
if [ ! -f "$HOME/.zfunc/_rustup" ]; then
rustup completions zsh rustup > "$HOME/.zfunc/_rustup"
fi
fpath=(${HOME}/.zfunc $fpath)
# initialise completions with ZSH's compinit
autoload -Uz compinit && compinit
fi
# Pretty command prompt
if (($+commands[starship])); then
eval "$(starship completions zsh)"
eval "$(starship init zsh)"
fi
# Display splash
if (($+commands[fastfetch])) && [ -z "$TMUX" ]; then
fastfetch
fi