From cf9349168f0c6fccdbc8ecc29b20922aefc03be1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leon=20Schwarz=C3=A4ugl?= Date: Wed, 16 Apr 2025 11:02:06 +0200 Subject: [PATCH] feat: improve zsh --- SwarselSystems.org | 45 +++++++++++++++++-------------------- modules/home/common/zsh.nix | 43 +++++++++++++++++------------------ 2 files changed, 41 insertions(+), 47 deletions(-) diff --git a/SwarselSystems.org b/SwarselSystems.org index a73bec9..7843339 100644 --- a/SwarselSystems.org +++ b/SwarselSystems.org @@ -9791,7 +9791,7 @@ The theme is handled by stylix. zsh is the most convenient shell for me and it happens to be super neat to configure within home manager. Here we set some aliases (some of them should be shellApplications instead) as well as some zsh plugins like =fzf-tab=. -Concerning the shell extensions, =zle = will run an existing widget and =zle -N = will make a function available for use. The =my-= functions all remove =.= =/= and =:= from the =WORDCHARS= so that functions will stop there. +Concerning the shell extensions, =zle = will run an existing widget and =zle -N = will make a function available for use. The =my-= functions all remove =.= =/= and =:= from the =WORDCHARS= so that functions will stop there. The keycodes can be found using =showkeys -a= #+begin_src nix :tangle modules/home/common/zsh.nix { config, pkgs, lib, ... }: @@ -9854,8 +9854,8 @@ Concerning the shell extensions, =zle = will run an existing widget history = { expireDuplicatesFirst = true; path = "$HOME/.histfile"; - save = 10000; - size = 10000; + save = 100000; + size = 100000; }; historySubstringSearch = { enable = true; @@ -9870,47 +9870,44 @@ Concerning the shell extensions, =zle = will run an existing widget ]; initExtra = '' my-forward-word() { - local WORDCHARS=$WORDCHARS - WORDCHARS="''${WORDCHARS//:}" - WORDCHARS="''${WORDCHARS//\/}" - WORDCHARS="''${WORDCHARS//.}" - zle backward-word + local WORDCHARS=$WORDCHARS + WORDCHARS="''${WORDCHARS//:}" + WORDCHARS="''${WORDCHARS//\/}" + WORDCHARS="''${WORDCHARS//.}" + zle forward-word } zle -N my-forward-word # ctrl + right bindkey "^[[1;5C" my-forward-word # shift + right - bindkey "^[[1;2D" forward-word + bindkey "^[[1;2C" forward-word my-backward-word() { - local WORDCHARS=$WORDCHARS - WORDCHARS="''${WORDCHARS//:}" - WORDCHARS="''${WORDCHARS//\/}" - WORDCHARS="''${WORDCHARS//.}" - zle forward-word + local WORDCHARS=$WORDCHARS + WORDCHARS="''${WORDCHARS//:}" + WORDCHARS="''${WORDCHARS//\/}" + WORDCHARS="''${WORDCHARS//.}" + zle backward-word } zle -N my-backward-word # ctrl + left - bindkey "^[[1;5D" -mybackward-word + bindkey "^[[1;5D" my-backward-word # shift + left - bindkey "^[[1;2C" backward-word + bindkey "^[[1;2D" backward-word my-backward-delete-word() { - local WORDCHARS=$WORDCHARS - WORDCHARS="''${WORDCHARS//:}" - WORDCHARS="''${WORDCHARS//\/}" - WORDCHARS="''${WORDCHARS//.}" - zle backward-delete-word + local WORDCHARS=$WORDCHARS + WORDCHARS="''${WORDCHARS//:}" + WORDCHARS="''${WORDCHARS//\/}" + WORDCHARS="''${WORDCHARS//.}" + zle backward-delete-word } zle -N my-backward-delete-word # ctrl + del bindkey '^H' my-backward-delete-word - # shift + del - bindkey '^?' backward-delete-word - ''; }; }; diff --git a/modules/home/common/zsh.nix b/modules/home/common/zsh.nix index d1b53ac..2fcc6c7 100644 --- a/modules/home/common/zsh.nix +++ b/modules/home/common/zsh.nix @@ -58,8 +58,8 @@ in history = { expireDuplicatesFirst = true; path = "$HOME/.histfile"; - save = 10000; - size = 10000; + save = 100000; + size = 100000; }; historySubstringSearch = { enable = true; @@ -74,47 +74,44 @@ in ]; initExtra = '' my-forward-word() { - local WORDCHARS=$WORDCHARS - WORDCHARS="''${WORDCHARS//:}" - WORDCHARS="''${WORDCHARS//\/}" - WORDCHARS="''${WORDCHARS//.}" - zle backward-word + local WORDCHARS=$WORDCHARS + WORDCHARS="''${WORDCHARS//:}" + WORDCHARS="''${WORDCHARS//\/}" + WORDCHARS="''${WORDCHARS//.}" + zle forward-word } zle -N my-forward-word # ctrl + right bindkey "^[[1;5C" my-forward-word # shift + right - bindkey "^[[1;2D" forward-word + bindkey "^[[1;2C" forward-word my-backward-word() { - local WORDCHARS=$WORDCHARS - WORDCHARS="''${WORDCHARS//:}" - WORDCHARS="''${WORDCHARS//\/}" - WORDCHARS="''${WORDCHARS//.}" - zle forward-word + local WORDCHARS=$WORDCHARS + WORDCHARS="''${WORDCHARS//:}" + WORDCHARS="''${WORDCHARS//\/}" + WORDCHARS="''${WORDCHARS//.}" + zle backward-word } zle -N my-backward-word # ctrl + left - bindkey "^[[1;5D" -mybackward-word + bindkey "^[[1;5D" my-backward-word # shift + left - bindkey "^[[1;2C" backward-word + bindkey "^[[1;2D" backward-word my-backward-delete-word() { - local WORDCHARS=$WORDCHARS - WORDCHARS="''${WORDCHARS//:}" - WORDCHARS="''${WORDCHARS//\/}" - WORDCHARS="''${WORDCHARS//.}" - zle backward-delete-word + local WORDCHARS=$WORDCHARS + WORDCHARS="''${WORDCHARS//:}" + WORDCHARS="''${WORDCHARS//\/}" + WORDCHARS="''${WORDCHARS//.}" + zle backward-delete-word } zle -N my-backward-delete-word # ctrl + del bindkey '^H' my-backward-delete-word - # shift + del - bindkey '^?' backward-delete-word - ''; }; };