blob: de03f2b05f87dc3b5b70d69bd2b666d70316c1ca (
plain)
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
|
# =============================================================================
# Filip's config for the Zoomer Shell
# =============================================================================
# ─── 1) Fundamental environment ──────────────────────────────────────────────
[ -f "$ALIASRC" ] && source "$ALIASRC"
fpath=(/usr/share/zsh/site-functions $fpath)
# ─── 2) Shell behaviour ──────────────────────────────────────────────────────
autoload -Uz colors && colors
setopt auto_pushd
setopt auto_param_slash
setopt no_check_jobs
setopt pushd_ignore_dups
setopt pushd_silent
setopt autocd
setopt auto_menu
setopt menu_complete
setopt interactive_comments
setopt no_case_glob
setopt no_case_match
unsetopt beep
[[ -t 0 ]] && {
stty stop undef
stty -ixon
}
zstyle ':completion:*' cache-path "${XDG_CACHE_HOME:-$HOME/.cache}/zsh/zcompcache"
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}'
zstyle ':completion:*' use-cache on
zstyle ':completion:*' special-dirs
zstyle ':completion:*' squeeze-slashes
# ─── 3) Prompt ───────────────────────────────────────────────────────────────
local blue=$(tput setaf 34)
local green=$(tput setaf 40)
local cyan=$(tput setaf 46)
local lime=$(tput setaf 154)
local reset=$(tput sgr0)
# Precomputed colors avoid running commands in PS1
PS1="%{$blue%}%n%{$green%}@%{$cyan%}%m %{$lime%}%1~ %{$reset%}$ "
# ─── 4) History ──────────────────────────────────────────────────────────────
HISTSIZE=100000
SAVEHIST=100000
if [[ ! -d "${XDG_CACHE_HOME:-$HOME/.cache}/shell" ]]; then
mkdir -p "${XDG_CACHE_HOME:-$HOME/.cache}/shell"
fi
HISTFILE="${XDG_CACHE_HOME:-$HOME/.cache}/shell/history"
setopt append_history
setopt inc_append_history
setopt share_history
setopt hist_ignore_all_dups
setopt hist_find_no_dups
setopt hist_save_no_dups
setopt hist_reduce_blanks
setopt hist_ignore_space
# ─── 5) Vi mode & ZVM variables ──────────────────────────────────────────────
export KEYTIMEOUT=1
ZVM_LINE_INIT_MODE=$ZVM_MODE_INSERT
ZVM_SYSTEM_CLIPBOARD_ENABLED="true"
ZVM_CLIPBOARD_COPY_CMD='xclip -selection clipboard'
ZVM_CLIPBOARD_PASTE_CMD='xclip -selection clipboard -o'
ZVM_LAZY_KEYBINDINGS="false"
# ─── 6) Antidote & plugins ───────────────────────────────────────────────────
ANTIDOTE_DIR="$HOME/.local/share/antidote"
PLUGIN_FILE="${ZDOTDIR:-$HOME}/.zsh_plugins"
STATIC_FILE="${XDG_CACHE_HOME:-$HOME/.cache}/zsh/plugins.zsh"
# Clone Antidote if not present
[[ -d "$ANTIDOTE_DIR" ]] || git clone --depth=1 https://github.com/mattmc3/antidote.git "$ANTIDOTE_DIR"
# Source Antidote
source "$ANTIDOTE_DIR/antidote.zsh"
# Initialize/Update the static load file if the plugin list changed
if [[ ! "$STATIC_FILE" -nt "$PLUGIN_FILE" ]]; then
mkdir -p "$(dirname "$STATIC_FILE")"
antidote bundle < "$PLUGIN_FILE" > "$STATIC_FILE"
fi
# Load the plugins
source "$STATIC_FILE"
# Autosuggestions config
ZSH_AUTOSUGGEST_STRATEGY=(history completion)
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#999999,bg=default,underline"
ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=100
# ─── 7) Completion ───────────────────────────────────────────────────────────
# Run compinit **after all plugins** to avoid wiping widgets
autoload -Uz compinit
if [[ -n ${ZDOTDIR:-$HOME}/.zcompdump(#qN.m1) ]]; then
compinit -C
else
compinit
fi
zstyle ':completion:*' menu select
zmodload zsh/complist
_comp_options+=(globdots extended_glob)
# ─── 8) Keybindings ──────────────────────────────────────────────────────────
# Better backspace in vi mode
bindkey -v '^?' backward-delete-char
# Menu navigation with vim keys
bindkey -M menuselect 'h' vi-backward-char
bindkey -M menuselect 'j' vi-down-line-or-history
bindkey -M menuselect 'k' vi-up-line-or-history
bindkey -M menuselect 'l' vi-forward-char
# history substring search (up/down)
bindkey '^[[A' history-substring-search-up
bindkey '^[[B' history-substring-search-down
bindkey -M vicmd 'k' history-substring-search-up
bindkey -M vicmd 'j' history-substring-search-down
# accept autosuggest
bindkey '^f' autosuggest-accept
# ─── 9) Custom functions & widgets ───────────────────────────────────────────
lfcd() {
local tmp="$(mktemp -uq)"
trap 'rm -f $tmp >/dev/null 2>&1 && trap - HUP INT QUIT TERM PWR EXIT' HUP INT QUIT TERM PWR EXIT
lf -last-dir-path="$tmp" "$@"
[ -f "$tmp" ] && {
local dir="$(cat "$tmp")"
[ -d "$dir" ] && [ "$dir" != "$(pwd)" ] && cd "$dir"
}
}
lfcd_widget() { zle -I; BUFFER="lfcd" ; zle accept-line; }
fzo_widget() { zle -I; BUFFER="fzo" ; zle accept-line; }
gitui_widget() { zle -I; BUFFER="gitui"; zle accept-line; }
htop_widget() { zle -I; BUFFER="htop" ; zle accept-line; }
zle -N lfcd_widget
zle -N fzo_widget
zle -N gitui_widget
zle -N htop_widget
bindkey -M viins '^o' lfcd_widget
bindkey -M vicmd '^o' lfcd_widget
bindkey -M viins '^z' fzo_widget
bindkey -M vicmd '^z' fzo_widget
bindkey -M viins '^g' gitui_widget
bindkey -M vicmd '^g' gitui_widget
bindkey -M viins '^t' htop_widget
bindkey -M vicmd '^t' htop_widget
# ─── 10) Tool initializations ─────────────────────────────────────────────────
eval "$(zoxide init zsh)"
eval "$(thefuck --alias)"
# ─── 11) Local overrides (create this file if needed) ─────────────────────────
[ -f ~/.zshrc.local ] && source ~/.zshrc.local
|