From 9e2c648b8f85336525099e0d4a7beaf70acd2449 Mon Sep 17 00:00:00 2001 From: Alex van de Sandt Date: Mon, 11 May 2026 14:49:35 -0500 Subject: [PATCH] Port zsh and general shell config to den aspects --- modules/shell/completions.zsh | 16 +++++++++++ modules/shell/keybindings.zsh | 3 ++ modules/shell/shell.nix | 15 ++++++++++ modules/shell/zsh.nix | 52 +++++++++++++++++++++++++++++++++++ modules/users/igneous.nix | 3 ++ 5 files changed, 89 insertions(+) create mode 100644 modules/shell/completions.zsh create mode 100644 modules/shell/keybindings.zsh create mode 100644 modules/shell/shell.nix create mode 100644 modules/shell/zsh.nix diff --git a/modules/shell/completions.zsh b/modules/shell/completions.zsh new file mode 100644 index 0000000..f9dcd9c --- /dev/null +++ b/modules/shell/completions.zsh @@ -0,0 +1,16 @@ +zstyle ':completion:*' auto-description 'specify: %d' +zstyle ':completion:*' completer _expand _complete _ignored _approximate +zstyle ':completion:*' completions 1 +zstyle ':completion:*' expand prefix suffix +zstyle ':completion:*' file-sort name +zstyle ':completion:*' glob 'NUMERIC == 2' +zstyle ':completion:*' group-name '' +zstyle ':completion:*' ignore-parents parent pwd +zstyle ':completion:*' list-colors '' +zstyle ':completion:*' matcher-list '' '+m:{[:lower:]}={[:upper:]} m:{[:lower:][:upper:]}={[:upper:][:lower:]}' '+r:|[._-]=** r:|=**' '+l:|=* r:|=*' +zstyle ':completion:*' max-errors 3 +zstyle ':completion:*' preserve-prefix '//[^/]##/' +zstyle ':completion:*' squeeze-slashes true +zstyle ':completion:*' substitute 'NUMERIC == 2' +zstyle ':completion:*' use-compctl false + diff --git a/modules/shell/keybindings.zsh b/modules/shell/keybindings.zsh new file mode 100644 index 0000000..67d8c13 --- /dev/null +++ b/modules/shell/keybindings.zsh @@ -0,0 +1,3 @@ +bindkey '\e[B' history-search-forward +bindkey '\e[A' history-search-backward +bindkey '^R' history-incremental-pattern-search-backward diff --git a/modules/shell/shell.nix b/modules/shell/shell.nix new file mode 100644 index 0000000..004670f --- /dev/null +++ b/modules/shell/shell.nix @@ -0,0 +1,15 @@ +{ + den.aspects.shell = { + homeManager = { + home.shellAliases = { + tree = "tree --gitignore"; + }; + + programs.starship = { + enable = true; + enableZshIntegration = true; + enableBashIntegration = true; + }; + }; + }; +} diff --git a/modules/shell/zsh.nix b/modules/shell/zsh.nix new file mode 100644 index 0000000..ec944a0 --- /dev/null +++ b/modules/shell/zsh.nix @@ -0,0 +1,52 @@ +let + completions = builtins.readFile ./completions.zsh; + keybindings = builtins.readFile ./keybindings.zsh; +in +{ + den.aspects.zsh = { + homeManager = + { lib, pkgs, ... }: + { + programs.zsh = { + enable = true; + enableCompletion = true; + enableVteIntegration = true; + + defaultKeymap = "emacs"; + + history = { + append = true; + findNoDups = true; + }; + + setOptions = [ + "NOMATCH" + "NOTIFY" + "NO_BEEP" + ]; + + # Load completion settings + initContent = lib.mkMerge [ + (lib.mkOrder 550 completions) + (lib.mkOrder 1000 keybindings) + ]; + + # Load plugins manually + plugins = [ + { + name = "sudo"; + file = "plugins/sudo/sudo.plugin.zsh"; + src = pkgs.fetchFromGitHub { + owner = "ohmyzsh"; + repo = "ohmyzsh"; + rev = "beadd56dd75e8a40fe0a7d4a5d63ed5bf9efcd48"; + sha256 = "sha256-e3zTM3rj4z6RwDai9i7KKrz6imTGmZiSAqcS9Mw2LZU="; + }; + } + ]; + + syntaxHighlighting.enable = true; + }; + }; + }; +} diff --git a/modules/users/igneous.nix b/modules/users/igneous.nix index 07a1034..d90be3b 100644 --- a/modules/users/igneous.nix +++ b/modules/users/igneous.nix @@ -6,6 +6,9 @@ den.batteries.define-user den.batteries.primary-user (den.batteries.user-shell "zsh") + + den.aspects.shell + den.aspects.zsh ]; homeManager = -- 2.51.2