home | blog | art | now | git gpg | email | rss

dotfiles

My personal dotfiles.
git clone git://pollux.codes/git/dotfiles.git
Log | Files | Refs
commit b9a1519b6e8a12461598f266aafbcc62016f43fd
parent 57833ab5ebd7f7cde94d3a618245a2062da0e022
Author: Pollux <pollux@pollux.codes>
Date:   Thu, 17 Jul 2025 22:19:40 -0500

Add .zshrc and associated files

Signed-off-by: Pollux <pollux@pollux.codes>

Diffstat:
A.zshrc | 5+++++
A.zshrc.d/00_env.zsh | 10++++++++++
A.zshrc.d/01_pyenv.zsh | 3+++
A.zshrc.d/05_zinit.zsh | 18++++++++++++++++++
A.zshrc.d/10_alias.zsh | 53+++++++++++++++++++++++++++++++++++++++++++++++++++++
A.zshrc.d/10_controls.zsh | 15+++++++++++++++
A.zshrc.d/10_history.zsh | 11+++++++++++
A.zshrc.d/10_theme.zsh | 17+++++++++++++++++
A.zshrc.d/20_shell_integration.zsh | 12++++++++++++
A.zshrc.d/30_vim_remote.zsh | 5+++++
A.zshrc.d/99_prompt.zsh | 2++
11 files changed, 151 insertions(+), 0 deletions(-)

diff --git a/.zshrc b/.zshrc @@ -0,0 +1,5 @@ +for file in ~/.zshrc.d/* ; do + if [ -f "$file" ] ; then + . "$file" + fi +done diff --git a/.zshrc.d/00_env.zsh b/.zshrc.d/00_env.zsh @@ -0,0 +1,10 @@ +export NOTMUCH_CONFIG="$HOME/.config/notmuch/config" + +# NNN + +export NNN_OPTS="aAegH" +export NNN_OPENER="sopen" +export NNN_BMS="h:$HOME;p:$HOME/documents/projects;v:$HOME/videos/archive" + +export EDITOR=vim +export VISUAL=$EDITOR diff --git a/.zshrc.d/01_pyenv.zsh b/.zshrc.d/01_pyenv.zsh @@ -0,0 +1,3 @@ +export PYENV_ROOT="$HOME/.pyenv" +[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH" +eval "$(pyenv init - zsh)" diff --git a/.zshrc.d/05_zinit.zsh b/.zshrc.d/05_zinit.zsh @@ -0,0 +1,18 @@ +ZINIT_HOME="${XDG_DATA_HOME:-${HOME}/.local/share}/zinit/zinit.git" + +if [ ! -d "$ZINIT_HOME" ]; then + mkdir -p "$(dirname $ZINIT_HOME)" + git clone https://github.com/zdharma-continuum/zinit.git "$ZINIT_HOME" +fi + +source "${ZINIT_HOME}/zinit.zsh" +zinit ice depth=1 +zinit light zsh-users/zsh-autosuggestions +zinit light zsh-users/zsh-syntax-highlighting +zinit light zsh-users/zsh-completions +zinit light Aloxaf/fzf-tab +zinit light jeffreytse/zsh-vi-mode + +autoload -U compinit && compinit + +zinit cdreplay -q diff --git a/.zshrc.d/10_alias.zsh b/.zshrc.d/10_alias.zsh @@ -0,0 +1,53 @@ +# Git +gs() { git status $@ } +ga() { git add $@ } +gc() { git commit -s $@ } +gca() { git commit -s --amend $@ } +gp() { git push --force-with-lease $@ } +gf() { git fetch $@ } + +# Run remote post-receive hook without changing repository. +grecv() { git commit --amend --allow-empty --no-edit; git push -f } + +# Dotfiles +dotfiles() { git --git-dir=$HOME/.dotfiles/ --work-tree=$HOME $@ } + +ds() { dotfiles status $@ } +da() { dotfiles add $@ } +dc() { dotfiles commit -s $@ } +dca() { dotfiles commit -s --amend $@ } +dp() { dotfiles push --force-with-lease $@ } +df() { dotfiles fetch $@ } + +# VPN +vpnup() { doas wg-quick up $@ } +vpndown() { doas wg-quick down $@ } + +# Misc +reload() { source ~/.zshrc } +ls() { lsd -AlL --icon-theme unicode $@ 2>/dev/null } + +# Better ui for core utils +# Note: None of these ultimately change the behavior of the commands, just give +# a better user experience + +# Helper function, runs the first argument with a nice UI showing the progress. +# It waits 5 seconds before showing the progress in case it is a quick operation. +# See progress --help for a list of the commands supported. +monitor() { + $@ &! + PID=$! + waitpid --timeout 5 $PID &> /dev/null + if [ $? -gt 0 ]; then + progress --wait --monitor --additional-command $1 --pid $PID + kill $PID &> /dev/null + fi + exit 0 +} + +#cp() { monitor /usr/bin/cp $@ } +#rm() { monitor /usr/bin/rm $@ } +#mv() { monitor /usr/bin/mv $@ } +#tar() { monitor /usr/bin/tar $@ } +#gzip() { monitor /usr/bin/gzip $@ } +#gunzip() { monitor /usr/bin/gunzip $@ } diff --git a/.zshrc.d/10_controls.zsh b/.zshrc.d/10_controls.zsh @@ -0,0 +1,15 @@ + +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 + +zvm_bindkey vicmd "k" up-line-or-beginning-search +zvm_bindkey vicmd "j" down-line-or-beginning-search + +zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}' +zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}" +zstyle ':completion:*' menu no + +VIM_MODE_INITIAL_KEYMAP=last diff --git a/.zshrc.d/10_history.zsh b/.zshrc.d/10_history.zsh @@ -0,0 +1,11 @@ +HISTSIZE=1000 +HISTFILE=~/.zsh_history +SAVEHIST=$HISTSIZE +HISTDUP=erase +setopt appendhistory +setopt sharehistory +setopt hist_ignore_space +setopt hist_ignore_all_dups +setopt hist_save_no_dups +setopt hist_ignore_dups +setopt hist_find_no_dups diff --git a/.zshrc.d/10_theme.zsh b/.zshrc.d/10_theme.zsh @@ -0,0 +1,17 @@ +ZSH_HIGHLIGHT_STYLES[unknown-token]=fg=red,bold +ZSH_HIGHLIGHT_STYLES[reserved-word]=fg=magenta +ZSH_HIGHLIGHT_STYLES[alias]=fg=magenta +ZSH_HIGHLIGHT_STYLES[suffix-alias]=fg=magenta +ZSH_HIGHLIGHT_STYLES[global-alias]=fg=magenta +ZSH_HIGHLIGHT_STYLES[builtin]=fg=magenta +ZSH_HIGHLIGHT_STYLES[function]=fg=magenta +ZSH_HIGHLIGHT_STYLES[command]=fg=green +ZSH_HIGHLIGHT_STYLES[precommand]=fg=magenta,bold +ZSH_HIGHLIGHT_STYLES[commandseparator]=none +ZSH_HIGHLIGHT_STYLES[hashed-command]=fg=black +ZSH_HIGHLIGHT_STYLES[autodirectory]=fg=magenta +ZSH_HIGHLIGHT_STYLES[path]=underline + + +ZSH_HIGHLIGHT_STYLES[single-hyphen-option]=fg=cyan +ZSH_HIGHLIGHT_STYLES[double-hyphen-option]=fg=blue diff --git a/.zshrc.d/20_shell_integration.zsh b/.zshrc.d/20_shell_integration.zsh @@ -0,0 +1,12 @@ +eval "$(fzf --zsh)" +# eval "$(zoxide init --cmd cd zsh)" + +command_not_found_handler() { + echo "Command $1 not found." + echo + find-command "$1" +} + +preexec() { + print -Pn "\e]0;$2\a" +} diff --git a/.zshrc.d/30_vim_remote.zsh b/.zshrc.d/30_vim_remote.zsh @@ -0,0 +1,5 @@ +if [ -n "$VIM_SERVERNAME" ]; then + alias vim='/usr/bin/vim --remote --servername $VIM_SERVERNAME' +else + alias vim='/usr/bin/vim --servername $(uuidgen)' +fi diff --git a/.zshrc.d/99_prompt.zsh b/.zshrc.d/99_prompt.zsh @@ -0,0 +1,2 @@ + +eval "$(oh-my-posh init zsh --config ~/.posh-pollux-theme.json)"