-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlinuxzshrc
More file actions
259 lines (220 loc) · 8.22 KB
/
Copy pathlinuxzshrc
File metadata and controls
259 lines (220 loc) · 8.22 KB
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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
# =============================================================================
# Zsh Configuration (Linux)
# =============================================================================
# -----------------------------------------------------------------------------
# Environment
# -----------------------------------------------------------------------------
# PATH
export PATH="$HOME/.cargo/bin:$PATH"
export PATH="$HOME/.local/bin:$PATH"
export PATH="$HOME/.local/share/gem/ruby/3.4.0/bin:$PATH"
export PATH="$HOME/coding/ece469/ee469-qemu/i386-softmmu:$PATH"
export PATH="/home/ronak/.cache/.bun/bin:$PATH"
# Other environment
export LANG=en_US.UTF-8
export EDITOR=nvim
export VISUAL=nvim
export PAGER=less
export LESS='-R'
export LS_COLORS="$(vivid generate catppuccin-mocha)"
export VIRTUAL_ENV_DISABLE_PROMPT=1
# Syntax highlighting highlighters path
export ZSH_HIGHLIGHT_HIGHLIGHTERS_DIR=/usr/share/zsh/plugins/zsh-syntax-highlighting/highlighters
# FZF
export FZF_DEFAULT_OPTS="
--color=bg+:#313244,bg:#1e1e2e,spinner:#f5e0dc,hl:#f38ba8
--color=fg:#cdd6f4,header:#f38ba8,info:#cba6f7,pointer:#f5e0dc
--color=marker:#b4befe,fg+:#cdd6f4,prompt:#cba6f7,hl+:#f38ba8
--color=selected-bg:#45475a
--multi"
# -----------------------------------------------------------------------------
# Options
# -----------------------------------------------------------------------------
# History
HISTFILE="$HOME/.zsh_history"
HISTSIZE=50000
SAVEHIST=10000
setopt extended_history
setopt hist_expire_dups_first
setopt hist_ignore_dups
setopt hist_ignore_space
setopt hist_verify
setopt share_history
# Directory navigation
setopt auto_cd
setopt auto_pushd
setopt pushd_ignore_dups
setopt pushdminus
# Completion
setopt auto_menu
setopt complete_in_word
setopt always_to_end
unsetopt menu_complete
unsetopt flowcontrol
# Misc
setopt multios
setopt long_list_jobs
setopt interactivecomments
setopt prompt_subst
# Word characters (exclude / from word boundaries)
WORDCHARS='*?_-.[]~=&;!#$%^(){}<>'
# -----------------------------------------------------------------------------
# Initialization
# -----------------------------------------------------------------------------
# Load colors
autoload -U colors && colors
# Completion system
zmodload -i zsh/complist
autoload -Uz compinit
mkdir -p "$HOME/.zsh/cache"
compinit
# Completion settings
zstyle ':completion:*' matcher-list 'm:{[:lower:][:upper:]}={[:upper:][:lower:]}' 'r:|=*' 'l:|=* r:|=*'
zstyle ':completion:*' special-dirs true
zstyle ':completion:*' list-colors ''
zstyle ':completion:*' use-cache yes
zstyle ':completion:*' cache-path "$HOME/.zsh/cache"
# Key bindings
# Vi mode
bindkey -v
# Terminal application mode
if (( ${+terminfo[smkx]} )) && (( ${+terminfo[rmkx]} )); then
function zle-line-init() { echoti smkx; }
function zle-line-finish() { echoti rmkx; }
zle -N zle-line-init
zle -N zle-line-finish
fi
# History search with arrow keys (works in both emacs and vi mode)
autoload -U up-line-or-beginning-search down-line-or-beginning-search
zle -N up-line-or-beginning-search
zle -N down-line-or-beginning-search
bindkey -M emacs '^[[A' up-line-or-beginning-search
bindkey -M emacs '^[[B' down-line-or-beginning-search
bindkey -M viins '^[[A' up-line-or-beginning-search
bindkey -M viins '^[[B' down-line-or-beginning-search
bindkey -M vicmd '^[[A' up-line-or-beginning-search
bindkey -M vicmd '^[[B' down-line-or-beginning-search
if [[ -n "$terminfo[kcuu1]" ]]; then
bindkey -M emacs "$terminfo[kcuu1]" up-line-or-beginning-search
bindkey -M emacs "$terminfo[kcud1]" down-line-or-beginning-search
bindkey -M viins "$terminfo[kcuu1]" up-line-or-beginning-search
bindkey -M viins "$terminfo[kcud1]" down-line-or-beginning-search
bindkey -M vicmd "$terminfo[kcuu1]" up-line-or-beginning-search
bindkey -M vicmd "$terminfo[kcud1]" down-line-or-beginning-search
fi
bindkey '^r' history-incremental-search-backward
# Magic functions (bracketed paste, url quoting)
autoload -Uz bracketed-paste-magic url-quote-magic
zle -N bracketed-paste bracketed-paste-magic
zle -N self-insert url-quote-magic
# -----------------------------------------------------------------------------
# Plugins (must be sourced after compinit)
# -----------------------------------------------------------------------------
# zsh-autosuggestions
source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
ZSH_AUTOSUGGEST_STRATEGY=(completion)
# FZF
{ eval "$(fzf --zsh)"; } 2>/dev/null
# zsh-syntax-highlighting (must be last)
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
# -----------------------------------------------------------------------------
# Functions
# -----------------------------------------------------------------------------
# Open command in background and exit
openclose() {
"$@" &
disown
exit
}
# Terminal title
autoload -Uz add-zsh-hook
set_term_title() {
print -Pn "\e]2;%n@%m:%~\a"
}
set_term_title_preexec() {
local cmd="${1[(wr)^(*=*|sudo|ssh|mosh|rake|-*)]:gs/%/%%}"
print -Pn "\e]2;$cmd\a"
}
add-zsh-hook precmd set_term_title
add-zsh-hook preexec set_term_title_preexec
# -----------------------------------------------------------------------------
# Theme (alanpeabody)
# -----------------------------------------------------------------------------
PROMPT='%{$fg[magenta]%}%n@%m%{$reset_color%} %{$fg[blue]%}%~%{$reset_color%}$ '
RPROMPT='%(?..%{$fg[red]%}%? ↵%{$reset_color%})'
# -----------------------------------------------------------------------------
# Aliases
# -----------------------------------------------------------------------------
# Git
alias g='git'
alias ga='git add'
alias gaa='git add --all'
alias gau='git add --update'
alias gb='git branch'
alias gba='git branch --all'
alias gbd='git branch --delete'
alias gc='git commit --verbose'
alias gca='git commit --verbose --all'
alias gcm='git checkout $(git_main_branch)'
alias gcd='git checkout $(git_develop_branch)'
alias gco='git checkout'
alias gcb='git checkout -b'
alias gcl='git clone --recurse-submodules'
alias gclean='git clean --interactive -d'
alias gd='git diff'
alias gds='git diff --staged'
alias gf='git fetch'
alias gfa='git fetch --all --tags --prune'
alias gl='git pull'
alias gp='git push'
alias gpsup='git push --set-upstream origin $(git_current_branch)'
alias gm='git merge'
alias gr='git remote'
alias grv='git remote --verbose'
alias gst='git status'
alias gss='git status --short'
alias grt='cd "$(git rev-parse --show-toplevel || echo .)"'
alias gwip='git add -A; git rm $(git ls-files --deleted) 2>/dev/null; git commit --no-verify --no-gpg-sign --message "--wip-- [skip ci]"'
alias gunwip='git rev-list --max-count=1 --format="%s" HEAD | grep -q "\--wip--" && git reset HEAD~1'
# Directory navigation
alias -g ...='../..'
alias -g ....='../../..'
alias -g .....='../../../..'
alias -- -='cd -'
alias md='mkdir -p'
alias rd=rmdir
# General
alias ls='eza --icons=always --hyperlink -a'
alias l='eza --icons=always --hyperlink -l'
alias ll='eza --icons=always --hyperlink -l'
alias la='eza --icons=always --hyperlink -la'
alias lt='eza --icons=always --hyperlink -l --sort=modified'
alias lta='eza --icons=always --hyperlink -la --sort=modified'
alias lS='eza --icons=always --hyperlink -l --sort=size'
alias lSa='eza --icons=always --hyperlink -la --sort=size'
alias l.='eza --icons=always --hyperlink -l -d .*'
alias tree='eza --icons=always --hyperlink --tree'
alias t='eza --icons=always --hyperlink --tree -L 2'
alias catvim=nvim
alias cv=nvim
alias code='code-insiders --ozone-platform=wayland'
alias windows='systemctl reboot --boot-loader-entry=auto-windows'
alias cdg='cd "$(git rev-parse --show-toplevel 2>/dev/null)"'
alias kittycat='kitten icat'
alias weather='curl wttr.in'
alias maps='telnet mapscii.me'
alias ssh='kitten ssh'
alias krabby='clear && krabby name'
alias :q='exit'
alias :qa='killall kitty'
# -----------------------------------------------------------------------------
# TTY Login
# -----------------------------------------------------------------------------
if [[ -z $DISPLAY && $(tty) = /dev/tty1 ]]; then
exec uwsm start select
fi
# -----------------------------------------------------------------------------
# Late sourcing
# -----------------------------------------------------------------------------
# Virtual environment
[[ -f ~/.venv/bin/activate ]] && source ~/.venv/bin/activate