-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdot_zshrc
More file actions
143 lines (112 loc) · 4.03 KB
/
dot_zshrc
File metadata and controls
143 lines (112 loc) · 4.03 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
# =============================================================================
# Oh My Zsh Configuration
# =============================================================================
export ZSH="$HOME/.oh-my-zsh"
# Set name of the theme to load
ZSH_THEME="powerlevel10k/powerlevel10k"
# Plugins to load
plugins=(
git
zsh-autosuggestions
zsh-syntax-highlighting
dirhistory
)
# Load Oh My Zsh
if [ -f "$ZSH/oh-my-zsh.sh" ]; then
source "$ZSH/oh-my-zsh.sh"
fi
# =============================================================================
# Environment Variables & PATH
# =============================================================================
export EDITOR=nvim
export VISUAL=code
# Priority for local binaries and mold linker
export PATH="$HOME/.local/bin/linkers:$HOME/.local/bin:$PATH"
# PATH for tools installed via uv and cargo
export PATH="$HOME/.cargo/bin:$HOME/.local/share/uv/tools/bin:$PATH"
# PNPM configuration
export PNPM_HOME="$HOME/.local/share/pnpm"
case ":$PATH:" in
*":$PNPM_HOME:"*) ;;
*) export PATH="$PNPM_HOME:$PATH" ;;
esac
# =============================================================================
# Tool Initializations (Zoxide & FZF)
# =============================================================================
eval "$(zoxide init zsh)"
source <(fzf --zsh)
# =============================================================================
# Advanced Update and Maintenance Functions
# =============================================================================
# Function to update all system components
update_all() {
echo "Starting full system update..."
echo "1. Updating system packages (Pacman)..."
sudo pacman -Syyu --noconfirm
if command -v paru &> /dev/null; then
echo "2. Updating AUR packages (Paru)..."
paru -Sua --noconfirm
fi
if command -v rustup &> /dev/null; then
echo "3. Updating Rust toolchain (Rustup)..."
rustup update
fi
if command -v uv &> /dev/null; then
echo "4. Updating Python tools (uv)..."
uv tool upgrade --all
fi
echo "Update process completed."
}
# Function for deep system cleanup
cleanup() {
echo "Starting system maintenance cleanup..."
# 1. Remove orphaned packages
echo "\n[1/6] Removing unused dependencies (orphans)..."
local orphans=$(pacman -Qtdq)
if [[ -n "$orphans" ]]; then
sudo pacman -Rns $orphans --noconfirm
else
echo "No orphaned packages found."
fi
# 2. Clean pacman cache (keeping last 2 versions)
if command -v paccache &> /dev/null; then
echo "\n[2/6] Cleaning package cache (paccache)..."
sudo paccache -rk2
fi
# 3. Clean systemd journal logs (older than 7 days)
echo "\n[3/6] Cleaning system logs (older than 7 days)..."
sudo journalctl --vacuum-time=7d
# 4. Clean uv cache (Python)
if command -v uv &> /dev/null; then
echo "\n[4/6] Cleaning uv cache..."
uv cache clean
fi
# 5. Clean Cargo cache (Rust)
if command -v cargo-cache &> /dev/null; then
echo "\n[5/6] Cleaning Cargo cache..."
cargo cache -a
else
echo "\n[5/6] Skipping Cargo cache (cargo-cache tool not found)."
fi
# 6. Remove user thumbnails and temporary files
echo "\n[6/6] Removing user thumbnails and pip cache..."
rm -rf ~/.cache/thumbnails/*
rm -rf ~/.cache/pip/* 2>/dev/null
echo "\nCleanup finished. System optimized."
}
# =============================================================================
# Aliases
# =============================================================================
alias lg='lazygit'
alias update='update_all'
alias cls='clear'
alias open='xdg-open'
# =============================================================================
# Source External Configs
# =============================================================================
# Local environment variables
if [ -f "$HOME/.local/bin/env" ]; then
. "$HOME/.local/bin/env"
fi
# Powerlevel10k prompt configuration
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh