Last active
August 21, 2025 22:18
-
-
Save bynect/8cec8c4a365d566312e2d93013b3fe85 to your computer and use it in GitHub Desktop.
.zshrc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ZDOTDIR=$HOME/.config/zsh | |
. $HOME/.local/share/cargo/env |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# XDG variables | |
export XDG_CONFIG_HOME="$HOME/.config" | |
export XDG_CACHE_HOME="$HOME/.cache" | |
export XDG_DATA_HOME="$HOME/.local/share" | |
export XDG_STATE_HOME="$HOME/.local/state" | |
command -v xdg-user-dirs-update >/dev/null 2>&1 && xdg-user-dirs-update | |
export DL="$HOME/dl/" | |
export XINITRC="$XDG_CONFIG_HOME/X11/xinitrc" | |
export WGETRC="$XDG_CONFIG_HOME/wgetrc" | |
export CARGO_HOME="$XDG_DATA_HOME/cargo" | |
export STACK_ROOT="$XDG_DATA_HOME/stack" | |
export OPAMROOT="$XDG_DATA_HOME/opam" | |
export PYTHONSTARTUP="$XDG_CONFIG_HOME/python/startup.py" | |
export PASSWORD_STORE_DIR="$XDG_CONFIG_HOME/pass" | |
# NOTE: SBCLI needs to be patched | |
export SBCLIRC="$XDG_CONFIG_HOME/sbclirc" | |
export GDBHISTFILE="$XDG_DATA_HOME/gdb/history" | |
export AMPL_LICFILE=$HOME/.cache/ampl/ampl.lic | |
export AMPLKEY_RUNTIME_DIR=$HOME/.cache/ampl | |
#export DOCKER_HOST=unix://$XDG_RUNTIME_DIR/docker.sock | |
# Fuck you java | |
export _JAVA_AWT_WM_NONREPARENTING=1 | |
export AWT_TOOLKIT=MToolkit | |
# NOTE: XAUTHORITY behaves weirdly when changing user | |
[ -z "$XAUTHORITY" ] && XAUTHORITY="$XDG_CONFIG_HOME/X11/Xauthority" | |
export XAUTHORITY | |
# Environment variables | |
export PATH="$HOME/go/bin:$HOME/.local/bin:$HOME/script:$HOME/.local/share/cargo/bin:/opt/ampl-linux:$HOME/.local/share/gem/ruby/3.3.0/bin:$PATH" | |
export GPG_TTY=$(tty) | |
export NO_AT_BRIDGE=1 | |
# SSH agent | |
export SSH_AUTH_SOCK=~/.ssh/ssh-agent.$HOST.sock | |
ssh-add -l 2>/dev/null >/dev/null | |
[ $? -ge 2 ] && ssh-agent -a "$SSH_AUTH_SOCK" >/dev/null | |
# Enable colored prompt | |
autoload -U colors | |
colors | |
PS1="%B%{$fg[cyan]%}%n%{$fg[magenta]%}@%{$fg[cyan]%}%M %{$fg[white]%}%~ %{$fg[magenta]%}λ%{$reset_color%}%b " | |
# Enable completion | |
autoload -U compinit | |
zstyle ':completion:*' menu select cache-path "$XDG_CACHE_HOME/zsh/zcompcache" | |
zmodload zsh/complist | |
compinit -d "$XDG_CACHE_HOME/zsh/zcompdump-$ZSH_VERSION" | |
_comp_options+=(globdots) | |
# Use ls colors | |
eval $(dircolors -b) | |
zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} | |
# Vi mode | |
bindkey -M menuselect 'h' vi-backward-char | |
bindkey -M menuselect 'k' vi-up-line-or-history | |
bindkey -M menuselect 'l' vi-forward-char | |
bindkey -M menuselect 'j' vi-down-line-or-history | |
bindkey -v '^?' backward-delete-char | |
# History settings | |
export LESSHISTFILE=- | |
export HISTFILE="$XDG_CACHE_HOME/zsh/history" | |
export HISTSIZE=100000 | |
export SAVEHIST=100000 | |
setopt hist_ignore_dups | |
setopt hist_expire_dups_first | |
setopt extended_history | |
export HISTORY_IGNORE="(git reset*|reboot|shutdown|exit|cd ..|cd ~|ls|pwd|clear|zshrc|vimrc|ll|la)" | |
# TODO: inc_append_history or share_history? | |
# https://zsh.sourceforge.io/Doc/Release/Options.html#History | |
setopt share_history | |
# History navigation | |
bindkey '^[[A' history-substring-search-up | |
bindkey '^[OA' history-substring-search-up | |
bindkey '^[[B' history-substring-search-down | |
bindkey '^[OB' history-substring-search-down | |
#bindkey "^[[A" history-beginning-search-backward | |
#bindkey "^[[B" history-beginning-search-forward | |
# Character deletion | |
bindkey "^[[3~" delete-char | |
bindkey "\eO3~" delete-char | |
bindkey "\e3~" delete-char | |
# Aliases | |
alias su="su --whitelist-environment=COLORTERM" | |
alias grep="grep --color=auto" | |
alias diff="diff --color=auto" | |
alias ip="ip -color=auto" | |
alias dir="dir --color=auto" | |
alias ls="ls --color=auto" | |
alias la="ls -a" | |
alias ll="ls -lah" | |
alias startx="startx $XINITRC --" | |
alias x="startx" | |
alias nvidia-settings="nvidia-settings --config=$XDG_CONFIG_HOME/nvidia/settings" | |
alias vimrc="vim ~/.vim/vimrc" | |
alias zshrc="vim ~/.config/zsh/.zshrc" | |
alias pwninit='pwninit --template-path ~/.config/pwninit-template.py --template-bin-name e' | |
alias cdcc='cd ~/doc/cc2025/' | |
alias pc-suspend="sudo loginctl suspend" | |
alias pc-reboot="sudo /usr/bin/loginctl reboot" | |
alias pc-poweroff="sudo /usr/bin/loginctl poweroff" | |
alias pc-update="sudo xbps-install -Syu" | |
findelf() { | |
find "${1:-.}" -type f -exec file --mime {} + 2>/dev/null | \ | |
grep -E 'application/x-(pie-)?executable|application/x-sharedlib' | \ | |
cut -d: -f1 | |
} | |
temps() { | |
paste <(cat /sys/class/thermal/thermal_zone*/type) \ | |
<(cat /sys/class/thermal/thermal_zone*/temp) | \ | |
column -s $'\t' -t | sed 's/\(.\)..$/.\1°C/' | |
} | |
export PYENV_ROOT="$HOME/.pyenv" | |
[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH" | |
eval "$(pyenv init - zshrc)" | |
source $HOME/.local/share/cargo/env | |
# Enable syntax highlighting | |
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh | |
# Enable history search | |
source /usr/share/zsh/plugins/zsh-history-substring-search/zsh-history-substring-search.zsh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment