diff options
| author | filip <“filip.rabiega@gmail.com”> | 2026-01-24 16:03:21 +0100 |
|---|---|---|
| committer | filip <“filip.rabiega@gmail.com”> | 2026-01-24 16:04:49 +0100 |
| commit | 204461150f735bb8234f4e86174978fb5a794de8 (patch) | |
| tree | ec5f687f071a35064823d627a2491ccb25576c7d | |
| parent | 85be0dd1e0267863bdb983bed0780ff06a8e7dff (diff) | |
| download | dotfiles-204461150f735bb8234f4e86174978fb5a794de8.tar.gz dotfiles-204461150f735bb8234f4e86174978fb5a794de8.tar.bz2 dotfiles-204461150f735bb8234f4e86174978fb5a794de8.zip | |
rewrite zshrc
| -rw-r--r-- | .config/shell/.zshrc | 168 | ||||
| -rw-r--r-- | .config/x11/xinitrc | 7 |
2 files changed, 98 insertions, 77 deletions
diff --git a/.config/shell/.zshrc b/.config/shell/.zshrc index 6c32a86..933df52 100644 --- a/.config/shell/.zshrc +++ b/.config/shell/.zshrc @@ -1,122 +1,137 @@ -# Filip's config for the Zoomer Shell - -# Enable colors and change prompt: -autoload -U colors && colors # Load colors -export PS1="%{$(tput setaf 34)%}%n%{$(tput setaf 40)%}@%{$(tput setaf 46)%}%m %{$(tput setaf 154)%}%1~ %{$(tput sgr0)%}$ " -setopt autocd # Automatically cd into typed directory. -stty stop undef # Disable ctrl-s to freeze terminal. +# ============================================================================= +# Filip's config for the zoomer shell +# ============================================================================= + +# ─── 1) Fundamental environment ────────────────────────────────────────────── +export PATH="$HOME/.local/bin:$PATH" + +# ─── 2) Shell behaviour ────────────────────────────────────────────────────── +autoload -U colors && colors +setopt auto_pushd +setopt no_check_jobs +setopt pushd_ignore_dups +setopt pushd_silent +setopt autocd setopt interactive_comments +stty stop undef +unsetopt beep + +zstyle ':completion:*' cache-path "${XDG_CACHE_HOME:-$HOME/.cache}/zsh/zcompcache" +zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' +zstyle ':completion:*' use-cache on + +# ─── 3) Prompt ─────────────────────────────────────────────────────────────── +blue=$(tput setaf 34) +green=$(tput setaf 40) +cyan=$(tput setaf 46) +lime=$(tput setaf 154) +reset=$(tput sgr0) + +PS1="%{$blue%}%n%{$green%}@%{$cyan%}%m %{$lime%}%1~ %{$reset%}$ " -# History in cache directory: +# ─── 4) History ────────────────────────────────────────────────────────────── HISTSIZE=10000000 SAVEHIST=10000000 HISTFILE="${XDG_CACHE_HOME:-$HOME/.cache}/shell/history" -setopt inc_append_history -# Load aliases and shortcuts if existent. -[ -f "$ALIASRC" ] && source "$ALIASRC" -[ -f "$ENVVARRC" ] && source "$ENVVARRC" +setopt inc_append_history +setopt hist_ignore_all_dups +setopt hist_find_no_dups +setopt hist_save_no_dups -# Basic auto/tab complete: +# ─── 5) Completion ─────────────────────────────────────────────────────────── autoload -U compinit zstyle ':completion:*' menu select zmodload zsh/complist +fpath=(/usr/share/zsh/site-functions $fpath) +[ -f "$ALIASRC" ] && source "$ALIASRC" +_comp_options+=(globdots) # hidden files compinit -_comp_options+=(globdots) # Include hidden files. -# vi mode -# bindkey -v +# ─── 6) Vi mode & keybindings ──────────────────────────────────────────────── export KEYTIMEOUT=1 +# bindkey -v # uncomment only if you don't use zsh-vi-mode plugin -# Exit even if there are running jobs -setopt NO_CHECK_JOBS +# Better backspace in vi mode +bindkey -v '^?' backward-delete-char + +# Menu navigation with vim keys +bindkey -M menuselect 'h' vi-backward-char +bindkey -M menuselect 'j' vi-down-line-or-history +bindkey -M menuselect 'k' vi-up-line-or-history +bindkey -M menuselect 'l' vi-forward-char -### Added by Zinit's installer -if [[ ! -f $HOME/.local/share/zinit/zinit.git/zinit.zsh ]]; then - print -P "%F{33} %F{220}Installing %F{33}ZDHARMA-CONTINUUM%F{220} Initiative Plugin Manager (%F{33}zdharma-continuum/zinit%F{220})…%f" - command mkdir -p "$HOME/.local/share/zinit" && command chmod g-rwX "$HOME/.local/share/zinit" - command git clone https://github.com/zdharma-continuum/zinit "$HOME/.local/share/zinit/zinit.git" && \ - print -P "%F{33} %F{34}Installation successful.%f%b" || \ - print -P "%F{160} The clone has failed.%f%b" -fi +# ─── 7) Zinit & plugins ────────────────────────────────────────────────────── +[[ ! -f $HOME/.local/share/zinit/zinit.git/zinit.zsh ]] && { + print -P "%F{33} Installing %F{220}Zinit…%f" + mkdir -p "$HOME/.local/share/zinit" + git clone https://github.com/zdharma-continuum/zinit "$HOME/.local/share/zinit/zinit.git" +} source "$HOME/.local/share/zinit/zinit.git/zinit.zsh" autoload -Uz _zinit (( ${+_comps} )) && _comps[zinit]=_zinit -# Load a few important annexes, without Turbo -# (this is currently required for annexes) zinit light-mode for \ zdharma-continuum/zinit-annex-as-monitor \ zdharma-continuum/zinit-annex-bin-gem-node \ zdharma-continuum/zinit-annex-patch-dl \ zdharma-continuum/zinit-annex-rust -### End of Zinit's installer chunk - -# Load plugins with zinit zinit ice depth=1 -zinit light jeffreytse/zsh-vi-mode -ZVM_VI_INSERT_ESCAPE_BINDKEY=jk -zinit light zsh-users/zsh-syntax-highlighting - -lfcd () { - tmp="$(mktemp -uq)" - trap 'rm -f $tmp >/dev/null 2>&1' HUP INT QUIT TERM PWR EXIT +zinit light-mode for \ + jeffreytse/zsh-vi-mode \ + zsh-users/zsh-autosuggestions \ + zsh-users/zsh-completions \ + zsh-users/zsh-history-substring-search \ + zsh-users/zsh-syntax-highlighting \ + +ZVM_LINE_INIT_MODE=$ZVM_MODE_INSERT +ZVM_SYSTEM_CLIPBOARD_ENABLED=true +ZVM_CLIPBOARD_COPY_CMD='xclip -selection clipboard' +ZVM_CLIPBOARD_PASTE_CMD='xclip -selection clipboard -o' +ZVM_LAZY_KEYBINDINGS=false +ZSH_AUTOSUGGEST_STRATEGY=(history completion) +ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#999999,bg=default,underline" +ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=100 + +# ─── 8) Custom functions & widgets ─────────────────────────────────────────── +lfcd() { + local tmp="$(mktemp -uq)" + trap 'rm -f $tmp >/dev/null 2>&1' EXIT lf -last-dir-path="$tmp" "$@" - if [ -f "$tmp" ]; then - dir="$(cat "$tmp")" + [ -f "$tmp" ] && { + local dir="$(cat "$tmp")" [ -d "$dir" ] && [ "$dir" != "$(pwd)" ] && cd "$dir" - fi -} - -# Some bindings -lfcd_widget() { - zle -I - BUFFER="lfcd" - zle accept-line + } } -gitui_widget() { - zle -I - BUFFER="gitui" - zle accept-line -} - -htop_widget() { - zle -I - BUFFER="htop" - zle accept-line -} +lfcd_widget() { zle -I; BUFFER="lfcd"; zle accept-line; } +gitui_widget() { zle -I; BUFFER="gitui"; zle accept-line; } +htop_widget() { zle -I; BUFFER="htop"; zle accept-line; } -# Register it as a ZLE widget zle -N lfcd_widget zle -N gitui_widget zle -N htop_widget -# Bind it in both vi keymaps bindkey -M viins '^o' lfcd_widget bindkey -M vicmd '^o' lfcd_widget - bindkey -M viins '^g' gitui_widget bindkey -M vicmd '^g' gitui_widget - bindkey -M viins '^t' htop_widget bindkey -M vicmd '^t' htop_widget -# Use vim keys in tab complete menu: -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 substring search (up/down) +bindkey '^[[A' history-substring-search-up +bindkey '^[[B' history-substring-search-down +bindkey -M vicmd 'k' history-substring-search-up +bindkey -M vicmd 'j' history-substring-search-down -# Edit line in vim with ctrl-e: -autoload edit-command-line; zle -N edit-command-line -bindkey '^e' edit-command-line -bindkey -M vicmd '^[[P' vi-delete-char -bindkey -M vicmd '^e' edit-command-line -bindkey -M visual '^[[P' vi-delete +# accept suggestion +bindkey '^f' autosuggest-accept + +# ─── 9) Tool initializations ───────────────────────────────────────────────── +eval "$(zoxide init zsh)" # >>> conda initialize >>> # !! Contents within this block are managed by 'conda init' !! @@ -132,3 +147,6 @@ bindkey -M visual '^[[P' vi-delete # fi # unset __conda_setup # <<< conda initialize <<< + +# ─── 10) Local overrides (create this file if needed) ───────────────────────── +[ -f ~/.zshrc.local ] && source ~/.zshrc.local diff --git a/.config/x11/xinitrc b/.config/x11/xinitrc index 59df04a..b895795 100644 --- a/.config/x11/xinitrc +++ b/.config/x11/xinitrc @@ -1,6 +1,9 @@ #!/bin/sh # xinitrc runs automatically when you run startx. -[ -f /home/filipek/.config/x11/xprofile ] && . /home/filipek/.config/x11/xprofile -[ -f /home/filipek/.config/x11/xinputrc ] && . /home/filipek/.config/x11/xinputrc +: "${XPROFILE:=$HOME/.config/x11/xprofile}" +: "${XINPUTRC:=$HOME/.config/x11/xinputrc}" + +[ -f "$XPROFILE" ] && . "$XPROFILE" +[ -f "$XINPUTRC" ] && . "$XINPUTRC" exec dwm |
