zsh/zshrc 5.3 K raw
1
# ~/.zshrc — managed by Guix Home (see home.scm)
2
3
# Interactive-only guard
4
case $- in
5
  *i*) ;;
6
  *) return ;;
7
esac
8
9
# =============================================================================
10
# History
11
# =============================================================================
12
HISTFILE="$HOME/.zsh_history"
13
HISTSIZE=10000
14
SAVEHIST=10000
15
setopt EXTENDED_HISTORY
16
setopt HIST_IGNORE_ALL_DUPS   # ~ HISTCONTROL=ignoredups
17
setopt HIST_IGNORE_SPACE      # ~ HISTCONTROL=ignorespace
18
setopt HIST_REDUCE_BLANKS
19
setopt APPEND_HISTORY         # ~ shopt -s histappend
20
setopt INC_APPEND_HISTORY
21
setopt share_history
22
setopt hist_verify
23
24
25
# vi mode
26
set -o vi
27
28
# Edit command in $EDITOR
29
autoload -Uz edit-command-line
30
zle -N edit-command-line
31
bindkey '^O' edit-command-line
32
33
# =============================================================================
34
# Environment
35
# =============================================================================
36
export EDITOR="emacs"
37
export CLICOLOR=1
38
export TERMINAL="kitty"
39
40
# Go
41
export GOPATH="$HOME/.local/share/go"
42
export GOMODCACHE="$HOME/.local/share/go-mod-cache"
43
44
# bat
45
export BAT_THEME="ansi"
46
export BAT_THEME_DARK="ansi"
47
48
# gpg
49
export GPG_TTY="$(tty)"
50
51
# misc
52
export BULLETS_FEEDS="feeds.stevedylan.dev/feed.xml"
53
54
# pnpm
55
# export PNPM_HOME="$HOME/.local/share/pnpm"
56
57
# bun
58
export BUN_INSTALL="$HOME/.bun"
59
60
# Weather
61
export NWS_LAT="35.0274115"
62
export NWS_LON="-85.3183822"
63
64
# stops GTK apps relaunching the accessibility bridge
65
export NO_AT_BRIDGE=1
66
67
# fzf
68
export FZF_DEFAULT_COMMAND='fd --type f --hidden --exclude ".git"'
69
export FZF_DEFAULT_OPTS='
70
  --color=fg:8:bold,fg+:15,bg:-1,bg+:-1
71
  --color=hl:10:bold,hl+:10:bold
72
  --color=info:8,spinner:9,header:4
73
  --color=prompt:2,pointer:9,marker:1
74
  --color=border:7,label:15:bold,query:15
75
  --border="rounded"
76
  --border-label=""
77
  --preview-window="border-rounded"
78
  --prompt="> "
79
  --marker=" "
80
  --pointer="◆"
81
  --separator=""
82
  --scrollbar=""
83
  --gutter=" "
84
  --info=inline-right'
85
86
# =============================================================================
87
# PATH
88
# =============================================================================
89
# Guix manages the system/profile entries; these are for tools installed
90
# outside of Guix (cargo, bun, foundry, ...).
91
# path_add <dir>: prepend if not already present and dir exists
92
path_add() {
93
  case ":$PATH:" in
94
    *":$1:"*) ;;
95
    *) [ -d "$1" ] && PATH="$1:$PATH" ;;
96
  esac
97
}
98
99
# path_add "$HOME/.cargo/bin"
100
path_add "$HOME/.local/share/go/bin"
101
path_add "$BUN_INSTALL/bin"
102
# path_add "$HOME/.tmux/plugins/t-smart-tmux-session-manager/bin"
103
# path_add "$HOME/.foundry/bin"
104
path_add "$HOME/.local/share"
105
# path_add "$HOME/.local/share/solana/install/active_release/bin"
106
# path_add "$HOME/.local/share/fnm"
107
# path_add "$PNPM_HOME"
108
path_add "$HOME/.local/bin"
109
path_add "$HOME/.bun/bin/"
110
111
export PATH
112
113
# cargo
114
# [ -f "$HOME/.cargo/env" ] && . "$HOME/.cargo/env"
115
116
# =============================================================================
117
# Aliases
118
# =============================================================================
119
alias ls='eza --icons=always'
120
alias ll='eza -l --icons=always'
121
alias la='eza -a --icons=always'
122
# alias lg='lazygit'
123
# alias nf='neofetch'
124
alias fl='fastfetch -c ~/.config/fastfetch/presets/examples/8.jsonc'
125
alias ff='fastfetch -c ~/.config/fastfetch/presets/examples/20.jsonc'
126
alias nvimrc='nvim ~/.config/nvim'
127
alias shitter='ssh itter'
128
# alias system='macchina'
129
# alias bonsai='cbonsai -li -t 0.4'
130
# alias lst='lstr --icons --color=always --size'
131
# alias timestamp='node -e "process.stdout.write(new Date().toISOString())"'
132
alias e='emacsclient -nw'
133
alias ghr='guix home reconfigure ~/guix-dotfiles/home.scm'
134
alias gsr='sudo guix system reconfigure ~/guix-dotfiles/config.scm'
135
136
# =============================================================================
137
# Functions
138
# =============================================================================
139
140
# UTC timestamp for blog frontmatter
141
blogdate() {
142
  date -u +"%Y-%m-%dT%H:%M:%SZ"
143
}
144
145
# =============================================================================
146
# Completion
147
# =============================================================================
148
# Pick up completions shipped by packages in the Guix profiles
149
for dir in "$HOME/.guix-home/profile/share/zsh/site-functions" \
150
           "$HOME/.guix-profile/share/zsh/site-functions"; do
151
  [ -d "$dir" ] && fpath=("$dir" $fpath)
152
done
153
unset dir
154
155
# bun completions
156
# [ -s "$BUN_INSTALL/_bun" ] && fpath=("$BUN_INSTALL" $fpath)
157
158
autoload -Uz compinit
159
compinit
160
161
# =============================================================================
162
# Tooling init
163
# =============================================================================
164
command -v zoxide >/dev/null 2>&1 && eval "$(zoxide init zsh)"
165
command -v starship >/dev/null 2>&1 && eval "$(starship init zsh)"
166
command -v fzf >/dev/null 2>&1 && eval "$(fzf --zsh)"
167
168
# zsh-autosuggestions and syntax highlighting (from the Guix Home profile).
169
# syntax-highlighting must be sourced last.
170
ZSH_PLUGINS="$HOME/.guix-home/profile/share/zsh/plugins"
171
[ -f "$ZSH_PLUGINS/zsh-autosuggestions/zsh-autosuggestions.zsh" ] &&
172
  source "$ZSH_PLUGINS/zsh-autosuggestions/zsh-autosuggestions.zsh"
173
[ -f "$ZSH_PLUGINS/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" ] &&
174
  source "$ZSH_PLUGINS/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
175
unset ZSH_PLUGINS