From f0f7ab04b0a988233f71d099cae72a1528485526 Mon Sep 17 00:00:00 2001 From: Timo Wilken Date: Thu, 8 Dec 2022 23:52:45 +0100 Subject: Adjust zshrc for Guix Remove Arch Linux-specific aliases. Also, allow use of load_plugin function after zshrc exits. --- zshrc | 39 +++++++++++---------------------------- 1 file changed, 11 insertions(+), 28 deletions(-) diff --git a/zshrc b/zshrc index 47bbc591..975b3b2a 100644 --- a/zshrc +++ b/zshrc @@ -37,7 +37,7 @@ bindkey '^[[H' vi-beginning-of-line # home bindkey '^[[F' vi-end-of-line # end ## History setup -# HISTSIZE should be set through ~/.pam_environment. +# HISTSIZE should be set through Guix's home environment service. HISTSIZE=10000000 HISTFILE=${XDG_DATA_HOME:-$HOME/.local/share}/zsh/history SAVEHIST=$HISTSIZE @@ -126,36 +126,21 @@ for _recutil in rec2csv recdel recfix recfmt recinf recins recsel recset; do done unset _recutil -# Arch -_cmds=('in' -S sinfo -Si linfo -Qi grp -Sg own -Qo lsf -Ql lsr -Sl lst -Qdt lstt -Qdtt) -_sudo_cmds=(upg -Syu ins -U ind '-S --asdeps' dep '-D --asdeps' re -R rem -Rns rec -Rnsc - ssch -Ss lsch -Qs upd -Sy rmt '-Rs $(paclst -q)' rmtt '-Rs $(paclstt -q)' - remt '-Rns $(paclst -q)' remtt '-Rns $(paclstt -q)') -for _cmd _args in ${(kv)_cmds}; do - alias "a$_cmd=pikaur $_args" - alias "pac$_cmd=pacman $_args" -done -for _cmd _args in ${(kv)_sudo_cmds}; do - alias "a$_cmd=pikaur $_args" - alias "pac$_cmd=sudo pacman $_args" -done -unset _cmd _args _cmds _sudo_cmds - ppscm () { guile -c "(use-modules (ice-9 pretty-print)) (with-input-from-file \"$1\" (compose pretty-print read))" | - source-highlight -s scheme -f esc | less -RSM + 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 +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 +if load_plugin zsh-autosuggestions; then bindkey '^ ' autosuggest-accept bindkey -M vicmd '^I' autosuggest-accept ZSH_AUTOSUGGEST_STRATEGY=(history completion) @@ -164,7 +149,7 @@ if _load_plugin zsh-autosuggestions; then ZSH_AUTOSUGGEST_MANUAL_REBIND=1 fi -if _load_plugin zsh-history-substring-search; then +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 @@ -173,9 +158,7 @@ if _load_plugin zsh-history-substring-search; then bindkey -M vicmd 'j' history-substring-search-down fi -_load_plugin zsh-autopair - -_load_plugin fast-syntax-highlighting || - _load_plugin zsh-syntax-highlighting +load_plugin zsh-autopair -unset _load_plugin +load_plugin fast-syntax-highlighting || + load_plugin zsh-syntax-highlighting -- cgit v1.2.3