diff options
author | Timo Wilken | 2022-12-30 10:54:17 +0100 |
---|---|---|
committer | Timo Wilken | 2022-12-30 10:54:17 +0100 |
commit | 0f308b1c90444f5f0293bf40aa1ef177bc51036c (patch) | |
tree | b052860a66b8bf3b094fa16e4538887003c37ada /zshrc | |
parent | da1ff8a0816e430d2c035217d80db3be5cc919ab (diff) |
Reorganise Guix home declaration into module tree
Diffstat (limited to 'zshrc')
-rw-r--r-- | zshrc | 168 |
1 files changed, 0 insertions, 168 deletions
@@ -1,168 +0,0 @@ -# Zsh configuration -*- sh -*- - -# Load functions from Guix profile, where packages like -# zsh-completions are installed. -if [ -d ~/.guix-home/profile/share/zsh/site-functions ]; then - fpath+=(~/.guix-home/profile/share/zsh/site-functions) -fi - -zmodload zsh/attr -zmodload -F zsh/cap b:cap -zmodload zsh/datetime -zmodload zsh/system -zmodload zsh/terminfo - -setopt extendedglob interactivecomments - -# So we don't have to call tput. -autoload -Uz colors -colors - -# GPG-agent setup -GPG_TTY=$(tty) && export GPG_TTY - -## Key bindings -# vi-like key mappings -bindkey -v - -bindkey '^[[A' up-line-or-history # up -bindkey '^[[B' down-line-or-history # down - -bindkey '^[[1;5A' up-line-or-history # C-up -bindkey '^[[1;5B' down-line-or-history # C-down -bindkey '^[[1;5C' vi-forward-word # C-right -bindkey '^[[1;5D' vi-backward-word # C-left - -bindkey '^[[H' vi-beginning-of-line # home -bindkey '^[[F' vi-end-of-line # end - -## History setup -# HISTSIZE should be set through Guix's home environment service. -HISTSIZE=10000000 -HISTFILE=${XDG_DATA_HOME:-$HOME/.local/share}/zsh/history -SAVEHIST=$HISTSIZE -setopt appendhistory sharehistory incappendhistory extendedhistory histverify histreduceblanks - -## Completion setup - -# don't need to run 'hash -r' after commands are added/removed -zstyle ':completion:*' rehash true - -# enable completion list colours -# http://linuxshellaccount.blogspot.com/2008/12/color-completion-using-zsh-modules-on.html -zstyle ':completion:*:*:*:*:hosts' list-colors "=*=${fg[blue]}" -zstyle ':completion:*:*:*:*:users' list-colors "=*=${fg[green]}=${fg[red]}" - -# formatting and messages -# http://www.masterzen.fr/2009/04/19/in-love-with-zsh-part-one/ -zstyle ':completion:*' verbose yes -zstyle ':completion:*:descriptions' format "${fg[green]}%B--- %d%b" -zstyle ':completion:*:messages' format '%d' -zstyle ':completion:*:warnings' format "${fg[red]}%BNo matches for:%b %d" -zstyle ':completion:*:corrections' format "${fg[yellow]}%B%d (%e char)%b" - -# https://stackoverflow.com/a/24237590 -#zstyle ':completion:*' matcher-list '' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*' - -# (mostly) from compinstall -zstyle ':completion:*' auto-description '(param: %d)' -zstyle ':completion:*' completer _expand _complete _ignored _approximate -zstyle ':completion:*' expand prefix suffix -zstyle ':completion:*' file-sort name -zstyle ':completion:*' group-name '' -zstyle ':completion:*' ignore-parents parent pwd directory -zstyle ':completion:*' insert-unambiguous false -eval "$(dircolors)" # set LS_COLORS -zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}" -zstyle ':completion:*' list-suffixes true -zstyle ':completion:*' matcher-list '' 'm:{[:lower:]}={[:upper:]}' 'r:|[._-]=** r:|=**' 'l:|=* r:|=*' -zstyle ':completion:*' max-errors 3 -zstyle ':completion:*' original true -zstyle ':completion:*' verbose true - -autoload -Uz compinit -if mkdir -p "${XDG_CACHE_HOME:-$HOME/.cache}/zsh"; then - compinit -d "${XDG_CACHE_HOME:-$HOME/.cache}/zsh/zcompdump-$ZSH_VERSION" -else - # Don't use dump file. - compinit -D -fi - -## Aliases -# Use ASYNC_EDITOR so I can continue using the shell while the editor -# remains open in a separate window. -alias em="$ASYNC_EDITOR" -alias se='sudo -e' -alias ls='\ls --color=auto -h' -alias la='\ls --color=auto -hA' -alias grep='\grep --color=auto' -alias diff='\diff -s --color=auto' -alias cdiff='\diff -s --color=always' -alias ipy='ipython3 --autoindent --automagic --pprint --no-banner --no-confirm-exit --term-title --autocall=1 --colors=Neutral' -alias rot13='caesar 13' -alias wget='\wget --hsts-file="${XDG_CACHE_HOME:-$HOME/.cache}/wget-hsts"' -alias aurora="REQUESTS_CA_BUNDLE=${XDG_CONFIG_HOME:-$HOME/.config}/cern-ca-bundle.crt \aurora" -alias aurora_admin="REQUESTS_CA_BUNDLE=${XDG_CONFIG_HOME:-$HOME/.config}/cern-ca-bundle.crt \aurora_admin" - -# Git aliases -alias ga='git add' -alias gb='git branch' -alias gc='git commit' -alias gd='git diff' -alias gds='git diff --staged' -alias gf='git fetch' -alias gfa='git fetch --all --prune --tags' -alias gk='git checkout' -alias gkb='git checkout -b' -alias gg='git glog' -alias gl='git pull' -alias gp='git push' -alias gr='git rebase' -alias gri='git rebase --interactive' -alias gs='git status' - -if recsel --version 2>/dev/null | grep -qFx 'recsel (GNU recutils) 1.8'; then - # Recutils 1.8 has a bug when TMPDIR is on a different mount point, see - # https://lists.gnu.org/archive/html/bug-recutils/2019-08/msg00001.html. - for _recutil in rec2csv recdel recfix recfmt recinf recins recsel recset; do - alias "$_recutil=TMPDIR=. $_recutil" - done - unset _recutil -fi - -ppscm () { - guile -c "(use-modules (ice-9 pretty-print)) (with-input-from-file \"$1\" (compose pretty-print read))" | - source-highlight -s scheme -f esc | $PAGER -} - -## Plugins -load_plugin () { - local try_path - for try_path in {/usr,"$GUIX_ENVIRONMENT","$HOME/.guix-profile","$HOME/.guix-home/profile"}"/share/zsh/plugins/$1/$1"{.plugin,}.zsh; do - [ -r "$try_path" ] && . "$try_path" && return 0 - done - return 1 -} - -if load_plugin zsh-autosuggestions; then - bindkey '^ ' autosuggest-accept - bindkey -M vicmd '^I' autosuggest-accept - ZSH_AUTOSUGGEST_STRATEGY=(history completion) - ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=20 - ZSH_AUTOSUGGEST_USE_ASYNC=1 - ZSH_AUTOSUGGEST_MANUAL_REBIND=1 -fi - -if load_plugin zsh-history-substring-search; then - bindkey '^[[A' history-substring-search-up - bindkey '^[[B' history-substring-search-down - bindkey -M emacs '^P' history-substring-search-up - bindkey -M emacs '^N' history-substring-search-down - bindkey -M vicmd 'k' history-substring-search-up - bindkey -M vicmd 'j' history-substring-search-down -fi - -load_plugin zsh-autopair - -load_plugin fast-syntax-highlighting || - load_plugin zsh-syntax-highlighting |