-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathzshrc
More file actions
147 lines (123 loc) · 3.62 KB
/
zshrc
File metadata and controls
147 lines (123 loc) · 3.62 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
# History
HISTSIZE=10000
SAVEHIST=10000
HISTFILE=~/.local/share/history/histfile
setopt appendhistory
setopt inc_append_history
setopt hist_ignore_all_dups
# Colors
autoload -U colors && colors
# Key bindings
bindkey -e
bindkey ';5D' backward-word # Ctrl+Left
bindkey ';5C' forward-word # Ctrl+Right
stty intr ^X # Replace Ctrl+C to Ctrl+X
stty susp undef # Disable Ctrl + Z
# Force keeping home folder clean
export XDG_CACHE_HOME="$HOME/.cache"
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_DATA_HOME="$HOME/.local/share"
export GNUPGHOME="$XDG_DATA_HOME/gnupg"
export NODE_COMPILE_CACHE="$XDG_CACHE_HOME/node"
export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME/npmrc"
export RIPGREP_CONFIG_PATH="$XDG_CONFIG_HOME/ripgreprc"
export CLAUDE_CONFIG_DIR="$XDG_DATA_HOME/claude"
# Completion
zstyle :compinstall filename "$HOME/.zshrc"
autoload -Uz compinit
compinit -i -d "$XDG_CACHE_HOME/zcompcache"
# Zsh plugins
export HISTORY_BASE="$XDG_CACHE_HOME/zsh_directory_history"
for plugin in \
zsh-syntax-highlighting/zsh-syntax-highlighting.zsh \
zsh-autosuggestions/zsh-autosuggestions.zsh \
per-directory-history/per-directory-history.zsh \
pnpm-shell-completion/pnpm-shell-completion.plugin.zsh
do
for dir in ~/.local/lib/zsh /usr/local/lib/zsh; do
if [[ -f $dir/$plugin ]]; then
source $dir/$plugin
break
fi
done
done
# Local binaries
export PATH="$HOME/.local/bin:$PATH"
# Prompt
if command -v starship > /dev/null 2>&1; then
eval "$(starship init zsh)"
elif [ -f ~/.local/bin/starship ]; then
eval "$(~/.local/bin/starship init zsh)"
fi
# History
if [ -f ~/.local/bin/atuin ]; then
eval "$(~/.local/bin/atuin init zsh --disable-up-arrow)"
fi
# Rip Grep
# Console editor
export EDITOR=micro
# Fix Bat in light console
export BAT_THEME=ansi
# Release function
release() {
local VERSION=$(grep -oP '(?<="version": ")[^"]*' package.json)
if [ -z "$VERSION" ]; then
echo "Version not found in package.json"
return 1
fi
git add .
git commit -m "Release $VERSION version"
git tag -s "$VERSION" -m "$VERSION"
git push
}
# Aliases
alias g='git'
alias ..='cd ..'
alias l='ls --all'
alias ll='ls --long --all --git'
if command -v bat > /dev/null 2>&1; then
alias cat='bat'
fi
if command -v eza > /dev/null 2>&1; then
alias ls='eza'
fi
alias r='dev node --run'
alias t='dev node --run test'
alias pn='dev pnpm'
alias pnx='dev pnpm dlx'
alias pui='pnpm update --interactive --latest -r --include-workspace-root'
alias pu='pnpm update -r --include-workspace-root'
alias pui1='pnpm update --interactive --latest'
alias pu1='pnpm update'
if [ -n "$container" ]; then
if [ -d "$HOME/.local/share/pnpm" ]; then
export PNPM_HOME="$HOME/.local/share/pnpm"
export PATH="$PNPM_HOME/bin/:$PATH"
fi
alias dev='command'
if [ -z "$SSH_AUTH_SOCK" ] && [ -S "/run/user/1000/gcr/ssh" ]; then
export SSH_AUTH_SOCK="/run/user/1000/gcr/ssh"
fi
else
export PATH="/home/ai/.local/lib/node/node_modules/.bin/:$PATH"
alias dev='/home/ai/Projects/environment/bin/dev'
alias devup='dev --up'
alias devdown='dev --down'
alias pnpm='dev pnpm'
alias node='dev node'
alias multiocular='dev --port pnpm multiocular'
# Run git hooks inside Dev Container
export GIT_CONFIG_PARAMETERS="'core.hooksPath=/home/ai/Projects/environment/hooks-trap'"
# Fast way to Dev projects
if [ -d ~/Projects ]; then
cdpath=(. ~/Projects)
fi
# Zed
alias e='~/Projects/environment/bin/zed-isolate .'
# Development
alias p='dev pnpm clean-publish --temp-dir .npm-release --without-publish \
&& cd .npm-release \
&& npm publish --access public \
&& cd .. \
&& rm -R .npm-release'
fi