dot_zshrc.tmpl
3866 bytes
1# vim: ft=zsh
2# History
3HISTFILE=~/.histfile
4HISTSIZE=40000
5SAVEHIST=40000
6HIST_STAMPS="yyyy-mm-dd"
7setopt HIST_IGNORE_DUPS
8
9if [ -z "${ZSH_ENV_SET}" ]; then
10 # CLI tools
11 export MAKEFLAGS="-j $(nproc --all)"
12 export LESS="-SRF --mouse"
13 export GPG_TTY=$(tty)
14 export GOPRIVATE="{{ if (index . "work") | default false }}github.com/duneanalytics/*,{{ end }}git.theedgeofrage.com/*"
15 export GOPATH="$HOME/dev/go"
16 export GOBIN="$HOME/dev/go/bin"
17 export VIRTUAL_ENV_DISABLE_PROMPT="true"
18 export COMPOSE_BAKE="true"
19 export FZF_CTRL_T_COMMAND="fd -tf -td -tl"
20 export FZF_DEFAULT_COMMAND='rg --files --hidden --follow -g "!{.git}/*" 2> /dev/null'
21 export FZF_DEFAULT_OPTS='
22 --color fg:#928374,bg:#282828,hl:#fb4934
23 --color fg+:#b8bb26,bg+:#3c3836,hl+:#fb4934
24 --color info:#fe8019,prompt:#83a598,header:#83a598
25 --color pointer:#fb4934,marker:#fb4934,spinner:#ffff60
26 '
27 export JQ_COLORS="1;31:0;35:0;35:0;39:0;32:1;39:1;39"
28{{ if (index . "gui" | default false) }}
29 # HDR
30 export ENABLE_HDR_WSI="1"
31{{- end }}
32
33 # Claude code
34 export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC="1"
35 export DISABLE_AUTOUPDATER="1"
36
37 # OpenCode
38 export OPENCODE_DISABLE_LSP_DOWNLOAD="true"
39 export OPENCODE_ENABLE_EXA="1"
40
41 # Pi
42 export LLAMA_BASE_URL="https://llama.home.theedgeofrage.com/v1"
43 export PI_WEB_TOOLS_EXA_ENDPOINT="https://mcp.exa.ai/mcp"
44
45 # Common config
46 export DEFAULT_USER="pavle"
47 export EDITOR="nvim"
48 export VISUAL="nvim"
49 export TERMINAL="ghostty"
50 export LANG="en_US.UTF-8"
51 export LC_ALL="C.UTF-8"
52 export PATH="$HOME/.local/bin:$PATH:$GOBIN:$HOME/.cargo/bin:$HOME/.local/share/nvim/mason/bin"
53 export XDG_CONFIG_HOME="$HOME/.config"
54 export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/gcr/ssh"
55
56 # Additional env vars
57 {{- range $entry := .zshrc.env_vars }}
58 export {{ $entry.name }}="{{ $entry.value }}"
59 {{- end }}
60
61 # Prevent zsh env vars from getting exported multiple times
62 export ZSH_ENV_SET="1"
63fi
64
65# Custom functions and completions
66CUSTOM="$HOME/.config/zsh"
67fpath=(${CUSTOM}/functions ${CUSTOM}/completions "${fpath[@]}" )
68autoload -Uz ${CUSTOM}/functions/*
69
70# oh-my-zsh
71export ZSH="$HOME/.config/zsh/oh-my-zsh"
72ZSH_THEME="boban/boban"
73HYPHEN_INSENSITIVE="true"
74DISABLE_AUTO_UPDATE="true"
75plugins=(
76 common-aliases
77 docker
78 docker-compose
79 git
80 gitfast
81 kubectl
82 you-should-use
83 zoxide
84 zsh-autosuggestions
85 zsh-autoswitch-virtualenv
86 zsh-completions
87 zsh-syntax-highlighting
88 zsh-autopair
89)
90source $ZSH/oh-my-zsh.sh
91
92# Misc options
93setopt extendedglob notify
94unsetopt beep nomatch
95bindkey -v
96zle_highlight+=(paste:none)
97
98# Copy current prompt to clipboard with CTRL+Y
99if [[ -n ${WAYLAND_DISPLAY} ]]; then
100 copy_line_to_x_clipboard() {
101 echo -n ${BUFFER} | wl-copy
102 zle reset-prompt
103 }
104 zle -N copy_line_to_x_clipboard
105 bindkey '^Y' copy_line_to_x_clipboard
106fi
107
108source ~/.aliases
109source ~/.config/zsh/kc.zsh
110
111# Bind home and end
112bindkey "\033[H" beginning-of-line
113bindkey "\033[F" end-of-line
114
115# zle -N zle-line-init
116TRAPWINCH() {
117 zle && { zle reset-prompt; zle -R }
118}
119
120# Load fzf
121if [[ $- == *i* ]] && [[ -d /usr/share/fzf/ ]]; then
122 source "/usr/share/fzf/completion.zsh" NO
123 source "/usr/share/fzf/key-bindings.zsh" NO
124fi
125
126type autopair-init &> /dev/null && autopair-init
127
128{{ if (index . "gui" | default false) -}}
129if [ -z "${WAYLAND_DISPLAY}" ] && [ "${XDG_VTNR}" -eq 1 ] && [[ $(tty) = /dev/tty1 ]]; then
130 # hyprland on tty1
131 exec uwsm start -e -D Hyprland hyprland.desktop
132elif [ -z "${WAYLAND_DISPLAY}" ] && [ "${XDG_VTNR}" -eq 3 ] && [[ $(tty) = /dev/tty3 ]]; then
133 exec gamescope-session-plus steam
134elif [[ $(tty) =~ "/dev/tty[0-9]" ]]; then
135 # Enable unicode characters in the tty
136 unicode_start
137fi
138{{- end }}