Repository navigation
Expand file tree
/
Copy pathzshrc
More file actions
executable file
·142 lines (121 loc) · 3.63 KB
/
Copy pathzshrc
File metadata and controls
executable file
·142 lines (121 loc) · 3.63 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
# Env
export PS1='${SSH_CONNECTION+"%n@%m:"}%~%# '
export PS2=' > '
export DIRSTACKSIZE=16
export EDITOR=nvim
export PAGER=less
export BROWSER=firefox
umask 022
# disable XON/XOFF flow control (^s/^q)
stty -ixon
# History
setopt HIST_IGNORE_SPACE
HISTFILE=~/.zsh_hist
HISTSIZE=100000
SAVEHIST=100000
# Use 'cat -v' to obtain the keycodes
autoload -U up-line-or-beginning-search
autoload -U down-line-or-beginning-search
zle -N up-line-or-beginning-search
zle -N down-line-or-beginning-search
bindkey "$key[Up]" up-line-or-beginning-search
bindkey "$key[Down]" down-line-or-beginning-search
bindkey "^[[1;5D" backward-word ## ctrl-right
bindkey "^[[1;5C" forward-word ## ctrl-left
bindkey " " magic-space ## do history expansion on space
# Zsh
setopt AUTO_PUSHD
setopt PUSHD_IGNORE_DUPS
setopt RM_STAR_SILENT
setopt HASH_CMDS
setopt HASH_DIRS
setopt PRINT_EXIT_VALUE
setopt NO_BG_NICE
setopt NO_BEEP
setopt PROMPT_SUBST
# Completion & prompt
fpath=(~/.zsh/Completion ~/.zsh/functions ~/.nix-profile/share/zsh/site-functions $fpath)
zmodload -i zsh/complist
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
zstyle ':completion::complete:*' use-cache 1
zstyle ':completion::complete:*' cache-path ~/.zsh/cache
zstyle ':completion::complete:cd::' tag-order local-directories path-directories
zstyle ':completion:*:processes' command 'ps -au$USER'
zstyle ':completion:*:*:kill:*:processes' list-colors "=(#b) #([0-9]#)*=36=31"
autoload -U compinit
compinit -u
autoload -U promptinit && promptinit
export DEFAULT_USER=nono
prompt unpure
# Add some colors
[ -f /etc/zsh_command_not_found ] && source /etc/zsh_command_not_found
source /usr/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
# Automatically list files after cd
autoload -U add-zsh-hook
add-zsh-hook -Uz chpwd (){ [[ -o interactive ]] && eza; }
# local stuff (not in git), like LLM tokens
[ -f ~/.zshrc.local ] && source ~/.zshrc.local
# mise
eval "$(mise activate zsh --shims)"
alias mx="mise exec"
alias mr="mise run"
# fzf
source <(fzf --zsh)
# Apt
alias ai='sudo apt install'
alias au='sudo apt update'
alias ad='sudo apt upgrade'
alias aud='sudo apt-get autoremove --purge && sudo apt update && sudo apt upgrade'
alias arm='sudo apt remove'
alias as='apt search'
# Aliases
alias -g L='|less'
alias -g G='|rg'
alias -g W='|wc'
alias ls='eza'
alias ll='eza -la'
alias lt='eza -laT'
alias less='less -RXFS'
alias v=nvim
alias o=xdg-open
alias m=make
alias pw='diceware -d _ -n 5 -s 5'
alias notes="rg 'TODO|FIXME|XXX|HACK'"
alias serve='thin -A file start'
mkcd() { mkdir -p "$1" && cd "$1" }
# Colored manpages
man() {
env LESS_TERMCAP_mb=$'\E[01;31m' \
LESS_TERMCAP_md=$'\E[01;38;5;74m' \
LESS_TERMCAP_me=$'\E[0m' \
LESS_TERMCAP_se=$'\E[0m' \
LESS_TERMCAP_so=$'\E[38;5;246m' \
LESS_TERMCAP_ue=$'\E[0m' \
LESS_TERMCAP_us=$'\E[04;38;5;146m' \
man "$@"
}
# Coding agents
export PATH="$HOME/.local/bin:$PATH"
alias c="claude"
alias dev="incus exec dev -- su --login nono"
alias devroot="incus exec dev -- /bin/bash"
# Golang
export PATH="$(go env GOPATH)/bin:$(go env GOBIN):$PATH"
alias gr='go run .'
alias doc='GODOCC_STYLE=native godocc'
# Node.js
export PATH="node_modules/.bin:$PATH"
export NODE_PATH="./lib"
# Ruby
export RUBYLIB="./ext:./lib"
export NOKOGIRI_USE_SYSTEM_LIBRARIES="true"
export GEM_HOME=$HOME/.gem
export PATH="$GEM_HOME/bin:$PATH"
alias be="bundle exec"
# Git
alias g='LANGUAGE=C.UTF-8 git'
alias gs='g status -s'
alias gd='g -c core.pager="hunk pager" diff'
alias gp='g pull origin main'
alias gpf='g push --force-with-lease'
alias gri='git rebase -i $(git merge-base $(git rev-parse --abbrev-ref HEAD) $(basename $(git symbolic-ref refs/remotes/origin/HEAD)))'