dotfiles

Linux and macOS dotfiles
git clone https://github.com/michaelneuper/dotfiles.git
README | Files | Log | Refs

commit 0a38a576ccc22333f67c31c53e023d20a1ca013c
parent f7c03d2e24449d0de1bb0d9813e50d9a6a23c32c
Author: michaelneuper <michael@michaelneuper.com>
Date:   Sun,  8 Jun 2025 16:07:42 +0200

update .zshrc

Diffstat:
M.zshrc | 229+++++++++++++++++--------------------------------------------------------------
1 file changed, 47 insertions(+), 182 deletions(-)

diff --git a/.zshrc b/.zshrc @@ -1,197 +1,62 @@ -# __ __ _ _ -#| \/ | \ | | -#| \ / | \| | Michael Neuper -#| |\/| | . ` | https://michaelneuper.com -#| | | | |\ | https://github.com/michaelneuper -#|_| |_|_| \_| -# -# If you come from bash you might have to change your $PATH. -# export PATH=$HOME/bin:/usr/local/bin:$PATH +# Path to your Oh My Zsh installation. +export ZSH="$HOME/.oh-my-zsh" -# Set $PATH if ~/.local/bin exist -if [ -d "$HOME/.local/bin" ]; then - export PATH=$HOME/.local/bin:$PATH -fi +# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes +# Cool themes: nicoulaj, refined, robbyrussell +# ZSH_THEME="refined" +unset ZSH_THEME -eval "$(starship init zsh)" -function set_win_title(){ - echo -ne "\033]0; $USER@$HOST:${PWD/$HOME/~} \007" -} -precmd_functions+=(set_win_title) - -## Plugins section: Enable fish style features -# Use syntax highlighting -# source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh - -# Use autosuggestion -# source /usr/share/zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh - -# Use history substring search -# source /usr/share/zsh/plugins/zsh-history-substring-search/zsh-history-substring-search.zsh - -# Use fzf -source /usr/share/fzf/key-bindings.zsh -source /usr/share/fzf/completion.zsh - -# Arch Linux command-not-found support, you must have package pkgfile installed -# https://wiki.archlinux.org/index.php/Pkgfile#.22Command_not_found.22_hook -[[ -e /usr/share/doc/pkgfile/command-not-found.zsh ]] && source /usr/share/doc/pkgfile/command-not-found.zsh - - -## Options section -setopt correct # Auto correct mistakes -setopt extendedglob # Extended globbing. Allows using regular expressions with * -setopt nocaseglob # Case insensitive globbing -setopt rcexpandparam # Array expension with parameters -setopt nocheckjobs # Don't warn about running processes when exiting -setopt numericglobsort # Sort filenames numerically when it makes sense -setopt nobeep # No beep -setopt appendhistory # Immediately append history instead of overwriting -setopt histignorealldups # If a new command is a duplicate, remove the older one -setopt autocd # if only directory path is entered, cd there. -setopt auto_pushd -setopt pushd_ignore_dups -setopt pushdminus - -# Completion. -autoload -Uz compinit -compinit -zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' # Case insensitive tab completion -zstyle ':completion:*' rehash true # automatically find new executables in path -zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}" # Colored completion (different colors for dirs/files/etc) -zstyle ':completion:*' completer _expand _complete _ignored _approximate -zstyle ':completion:*' menu select -zstyle ':completion:*' select-prompt '%SScrolling active: current selection at %p%s' -zstyle ':completion:*:descriptions' format '%U%F{cyan}%d%f%u' - -# Speed up completions -zstyle ':completion:*' accept-exact '*(N)' -zstyle ':completion:*' use-cache on -zstyle ':completion:*' cache-path ~/.cache/zcache - -# automatically load bash completion functions -autoload -U +X bashcompinit && bashcompinit +CASE_SENSITIVE="false" +HYPHEN_INSENSITIVE="true" -HISTFILE=~/.zhistory -HISTSIZE=50000 -SAVEHIST=10000 +# Uncomment one of the following lines to change the auto-update behavior +# zstyle ':omz:update' mode disabled # disable automatic updates +# zstyle ':omz:update' mode auto # update automatically without asking +zstyle ':omz:update' mode reminder # just remind me to update when it's time +# Uncomment the following line to change how often to auto-update (in days). +zstyle ':omz:update' frequency 15 -## Keys -# Use emacs key bindings -bindkey -e +# Uncomment the following line to display red dots whilst waiting for completion. +# You can also set it to another string to have that shown instead of the default red dots. +# e.g. COMPLETION_WAITING_DOTS="%F{yellow}waiting...%f" +# Caution: this setting can cause issues with multiline prompts in zsh < 5.7.1 (see #5765) +COMPLETION_WAITING_DOTS="true" -# [PageUp] - Up a line of history -if [[ -n "${terminfo[kpp]}" ]]; then - bindkey -M emacs "${terminfo[kpp]}" up-line-or-history - bindkey -M viins "${terminfo[kpp]}" up-line-or-history - bindkey -M vicmd "${terminfo[kpp]}" up-line-or-history -fi -# [PageDown] - Down a line of history -if [[ -n "${terminfo[knp]}" ]]; then - bindkey -M emacs "${terminfo[knp]}" down-line-or-history - bindkey -M viins "${terminfo[knp]}" down-line-or-history - bindkey -M vicmd "${terminfo[knp]}" down-line-or-history -fi +# Uncomment the following line if you want to disable marking untracked files +# under VCS as dirty. This makes repository status check for large repositories +# much, much faster. +# DISABLE_UNTRACKED_FILES_DIRTY="true" -# Start typing + [Up-Arrow] - fuzzy find history forward -if [[ -n "${terminfo[kcuu1]}" ]]; then - autoload -U up-line-or-beginning-search - zle -N up-line-or-beginning-search +# Which plugins would you like to load? +# Standard plugins can be found in $ZSH/plugins/ +# Custom plugins may be added to $ZSH_CUSTOM/plugins/ +# Example format: plugins=(rails git textmate ruby lighthouse) +# Add wisely, as too many plugins slow down shell startup. +plugins=(starship git vi-mode colored-man-pages macos zsh-syntax-highlighting zsh-autosuggestions) - bindkey -M emacs "${terminfo[kcuu1]}" up-line-or-beginning-search - bindkey -M viins "${terminfo[kcuu1]}" up-line-or-beginning-search - bindkey -M vicmd "${terminfo[kcuu1]}" up-line-or-beginning-search -fi -# Start typing + [Down-Arrow] - fuzzy find history backward -if [[ -n "${terminfo[kcud1]}" ]]; then - autoload -U down-line-or-beginning-search - zle -N down-line-or-beginning-search - - bindkey -M emacs "${terminfo[kcud1]}" down-line-or-beginning-search - bindkey -M viins "${terminfo[kcud1]}" down-line-or-beginning-search - bindkey -M vicmd "${terminfo[kcud1]}" down-line-or-beginning-search -fi +source $ZSH/oh-my-zsh.sh -# [Home] - Go to beginning of line -if [[ -n "${terminfo[khome]}" ]]; then - bindkey -M emacs "${terminfo[khome]}" beginning-of-line - bindkey -M viins "${terminfo[khome]}" beginning-of-line - bindkey -M vicmd "${terminfo[khome]}" beginning-of-line -fi -# [End] - Go to end of line -if [[ -n "${terminfo[kend]}" ]]; then - bindkey -M emacs "${terminfo[kend]}" end-of-line - bindkey -M viins "${terminfo[kend]}" end-of-line - bindkey -M vicmd "${terminfo[kend]}" end-of-line -fi +# User configuration -# [Shift-Tab] - move through the completion menu backwards -if [[ -n "${terminfo[kcbt]}" ]]; then - bindkey -M emacs "${terminfo[kcbt]}" reverse-menu-complete - bindkey -M viins "${terminfo[kcbt]}" reverse-menu-complete - bindkey -M vicmd "${terminfo[kcbt]}" reverse-menu-complete -fi +VI_MODE_RESET_PROMPT_ON_MODE_CHANGE=true +VI_MODE_SET_CURSOR=true -# [Backspace] - delete backward -bindkey -M emacs '^?' backward-delete-char -bindkey -M viins '^?' backward-delete-char -bindkey -M vicmd '^?' backward-delete-char -# [Delete] - delete forward -if [[ -n "${terminfo[kdch1]}" ]]; then - bindkey -M emacs "${terminfo[kdch1]}" delete-char - bindkey -M viins "${terminfo[kdch1]}" delete-char - bindkey -M vicmd "${terminfo[kdch1]}" delete-char -else - bindkey -M emacs "^[[3~" delete-char - bindkey -M viins "^[[3~" delete-char - bindkey -M vicmd "^[[3~" delete-char - - bindkey -M emacs "^[3;5~" delete-char - bindkey -M viins "^[3;5~" delete-char - bindkey -M vicmd "^[3;5~" delete-char +# Set $PATH if ~/.local/bin exist +if [ -d "$HOME/.local/bin" ]; then + export PATH=$HOME/.local/bin:$PATH fi +export PATH="$HOME/.config/emacs/bin:$PATH" +export PATH="/opt/homebrew/opt/openjdk/bin:$PATH" + +HISTFILE=~/.zhistory +HISTSIZE=50000 +SAVEHIST=10000 + +alias cat="bat --plain --theme=gruvbox-dark" -# Common use -alias grubup="sudo update-grub" -alias fixpacman="sudo rm /var/lib/pacman/db.lck" -alias tarnow='tar -acf ' -alias untar='tar -zxvf ' -alias wget='wget -c ' -alias rmpkg="sudo pacman -Rdd" -alias psmem='ps auxf | sort -nr -k 4' -alias psmem10='ps auxf | sort -nr -k 4 | head -10' -alias ..='cd ..' -alias ...='cd ../..' -alias ....='cd ../../..' -alias .....='cd ../../../..' -alias ......='cd ../../../../..' -alias dir='dir --color=auto' -alias vdir='vdir --color=auto' -alias grep='grep --color=auto' -alias fgrep='fgrep --color=auto' -alias egrep='egrep --color=auto' -alias hw='hwinfo --short' # Hardware Info -alias big="expac -H M '%m\t%n' | sort -h | nl" # Sort installed packages according to size in MB (expac must be installed) -alias gitpkg='pacman -Q | grep -i "\-git" | wc -l' # List amount of -git packages - -# Get fastest mirrors -alias mirror="sudo reflector -f 30 -l 30 --number 10 --verbose --save /etc/pacman.d/mirrorlist" -alias mirrord="sudo reflector --latest 50 --number 20 --sort delay --save /etc/pacman.d/mirrorlist" -alias mirrors="sudo reflector --latest 50 --number 20 --sort score --save /etc/pacman.d/mirrorlist" -alias mirrora="sudo reflector --latest 50 --number 20 --sort age --save /etc/pacman.d/mirrorlist" - -# Help normies -alias apt-get='man pacman' -alias apt='man pacman' -alias helpme='cht.sh --shell' -alias pacdiff='sudo -H DIFFPROG=meld pacdiff' # Compare .pacnew & .pacsave files -alias paru="paru --bottomup" -alias please='sudo' -alias tb='nc termbin.com 9999' -alias upd="/usr/bin/update" - -# Replace yay with paru if installed -[ ! -x /usr/bin/yay ] && [ -x /usr/bin/paru ] && alias yay='paru' +# fix LaTeX rendering in emacs +export LIBGS="/opt/homebrew/lib/libgs.dylib" +alias v="emacs -nw"