-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexecutable_dot_zshrc
226 lines (193 loc) · 6.42 KB
/
executable_dot_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
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
# -----------------------------
# Plugin Managers & Plugins
# -----------------------------
# Znap
[[ -r ~/Repos/znap/znap.zsh ]] || git clone --depth 1 -- https://github.com/marlonrichert/zsh-snap.git ~/Repos/znap
source ~/Repos/znap/znap.zsh
# Zinit
if [[ ! -f $HOME/.local/share/zinit/zinit.git/zinit.zsh ]]; then
print -P "%F{33} %F{220}Installing %F{33}ZDHARMA-CONTINUUM%F{220} Initiative Plugin Manager (%F{33}zdharma-continuum/zinit%F{220})…%f"
command mkdir -p "$HOME/.local/share/zinit" && command chmod g-rwX "$HOME/.local/share/zinit"
command git clone https://github.com/zdharma-continuum/zinit "$HOME/.local/share/zinit/zinit.git" && \
print -P "%F{33} %F{34}Installation successful.%f%b" || \
print -P "%F{160} The clone has failed.%f%b"
fi
source "$HOME/.local/share/zinit/zinit.git/zinit.zsh"
autoload -Uz _zinit
(( ${+_comps} )) && _comps[zinit]=_zinit
# Zinit Annexes
zinit light-mode for \
zdharma-continuum/zinit-annex-as-monitor \
zdharma-continuum/zinit-annex-bin-gem-node \
zdharma-continuum/zinit-annex-patch-dl \
zdharma-continuum/zinit-annex-rust
# Zinit Plugins
zinit load atuinsh/atuin
zinit light zsh-users/zsh-syntax-highlighting
zinit light Aloxaf/fzf-tab
# zsh-autosuggestions
source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
# -----------------------------
# Path & Environment Variables
# -----------------------------
export PATH="$PATH:/opt/nvim-linux64/bin"
export PATH="$PATH:/home/d7om/.bun/bin"
export PATH="$PATH:/home/d7om/.local/bin"
export PATH="$PATH:$HOME/go/bin/"
export PATH="$PATH:/home/linuxbrew/.linuxbrew/bin/go"
export PATH="$PATH:/home/d7om/.cargo/bin"
export PATH="$PATH:$HOME/.spicetify"
export PATH=~/.console-ninja/.bin:$PATH
# Development environments
export BUN_INSTALL="$HOME/.bun"
export PNPM_HOME="$HOME/.local/share/pnpm"
export NVM_DIR="$HOME/.config/nvm"
export ANDROID_HOME=$HOME/Android/Sdk
export DOTNET_ROOT=$HOME/.dotnet
export PATH="$PATH:$DOTNET_ROOT:$DOTNET_ROOT/tools"
# Android paths
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/platform-tools
# System configuration
export EDITOR=nvim
export HYPRSHOT_DIR=$HOME/Pictures/Screenshots/
export HOMEBREW_AUTO_UPDATE_SECS=0
export QT_QPA_PLATFORM=xcb
# Graphics settings
export __GLX_VENDOR_LIBRARY_NAME=nvidia
export __GL_SYNC_TO_VBLANK=0
export __GL_SYNC_DISPLAY_DEVICE=DP-0
# -----------------------------
# Tool Configurations
# -----------------------------
# pnpm
case ":$PATH:" in
*":$PNPM_HOME:"*) ;;
*) export PATH="$PNPM_HOME:$PATH" ;;
esac
# nvm
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
# Linuxbrew
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
# Zoxide
eval "$(zoxide init zsh)"
# Bun completions
[ -s "$HOME/.bun/_bun" ] && source "$HOME/.bun/_bun"
# -----------------------------
# FZF Configuration
# -----------------------------
source <(fzf --zsh)
# FZF Theme
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 \
--color=fg:#c6d0f5,fg+:#c6d0f5,bg:-1,bg+:#313244 \
--color=hl:#f38ba8,hl+:#f38ba8,info:#cba6f7,marker:#b4befe \
--color=prompt:#cba6f7,spinner:#f5e0dc,pointer:#f5e0dc,header:#f38ba8 \
--color=border:#262626,label:#aeaeae,query:#d9d9d9 \
--border=rounded --border-label='' --preview-window=border-rounded --prompt='❯' \
--marker='|' --pointer='◆' --separator='─' --scrollbar='│|' \
--info=right"
# fzf-tab configuration
zstyle ':completion:*:git-checkout:*' sort false
zstyle ':fzf-tab:*' use-fzf-default-opts yes
zstyle ':fzf-tab:*' fzf-command ftb-tmux-popup
zstyle ':fzf-tab:*' popup-min-size 100 8
zstyle ':completion:*' menu no
# preview directory's content with eza when completing cd
zstyle ':fzf-tab:complete:cd:*' fzf-preview 'eza -1 --color=always $realpath'
# custom fzf flags
# fzf-tab-source
[[ ! -d ${TMPPREFIX:-/tmp/zsh}-fzf-tab-$USER ]] && mkdir -p ${TMPPREFIX:-/tmp/zsh}-fzf-tab-$USER
if [[ ! -d $HOME/Packages/fzf-tab-source ]]; then
mkdir -p $HOME/Packages/
git clone https://github.com/Freed-Wu/fzf-tab-source $HOME/Packages/fzf-tab-source
fi
source $HOME/Packages/fzf-tab-source/fzf-tab-source.plugin.zsh
# -----------------------------
# Custom Functions
# -----------------------------
# Yazi file manager
function yy() {
local tmp="$(mktemp -t "yazi-cwd.XXXXXX")"
yazi "$@" --cwd-file="$tmp"
if cwd="$(cat -- "$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then
cd -- "$cwd"
fi
rm -f -- "$tmp"
}
# Tmux functions
function t() {
if [[ -z "$1" ]]; then
tmux
else
tmux has-session -t "$1" 2>/dev/null
if [[ $? -eq 0 ]]; then
tmux attach-session -t "$1"
else
tmux new-session -s "$1"
fi
fi
}
function tr() {
if [[ -z "$1" ]]; then
echo "Please provide a name."
elif [[ "$1" == "w" ]]; then
tmux rename-window "$2"
else
tmux rename-session "$1"
fi
}
# Sesh session manager
function sesh-sessions() {
{
exec </dev/tty
exec <&1
local session
session=$(sesh list -t -c | fzf --height 40% --reverse --border-label ' sesh ' --border --prompt '⚡ ')
[[ -z "$session" ]] && return
sesh connect $session
}
}
# -----------------------------
# Keybindings
# -----------------------------
bindkey -s '^f' 'ff\n'
zle -N sesh-sessions
bindkey -M emacs '\es' sesh-sessions
bindkey -M vicmd '\es' sesh-sessions
bindkey -M viins '\es' sesh-sessions
function zle-line-init zle-keymap-select {
RPS1="${${KEYMAP/vicmd/}/(main|viins)/}"
RPS2=$RPS1
zle reset-prompt
}
zle -N zle-line-init
zle -N zle-keymap-select
# -----------------------------
# Startup Configuration
# -----------------------------
# Tmux session selector
if [ -z "$TMUX" ]; then
sesh connect "$(sesh list -i | gum filter --limit 1 --placeholder 'Pick a sesh' --prompt='⚡')"
fi
#
# -----------------------------
# Core ZSH Configuration
# -----------------------------
autoload -Uz compinit
compinit
setopt extended_glob
setopt correct
# Source additional configs
source ~/.aliasesrc
# Starship prompt
eval "$(starship init zsh)"
eval "$(batman --export-env)"
# Load Angular CLI autocompletion.
source <(ng completion script)
[[ -f ~/.inshellisense/zsh/init.zsh ]] && source ~/.inshellisense/zsh/init.zsh