From 3e208d20934bedd8cd7769f23f35cfae9d8e7d0d Mon Sep 17 00:00:00 2001 From: Seth Flynn Date: Fri, 14 Feb 2025 01:18:47 -0500 Subject: seth: simplify module structure Moving to mixins generally reduces the boilerplate in all configurations, and less custom "stuff" These are then enabled by the regular options in programs.nix for example Many of the other options (like desktops) also had little use in being abstracted as there's no situation where I'd *not* want them to be applied when said desktop is in use --- users/seth/programs/zsh.nix | 118 -------------------------------------------- 1 file changed, 118 deletions(-) delete mode 100644 users/seth/programs/zsh.nix (limited to 'users/seth/programs/zsh.nix') diff --git a/users/seth/programs/zsh.nix b/users/seth/programs/zsh.nix deleted file mode 100644 index 7a7f935..0000000 --- a/users/seth/programs/zsh.nix +++ /dev/null @@ -1,118 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: -let - cfg = config.seth.programs.zsh; -in -{ - options.seth.programs.zsh = { - enable = lib.mkEnableOption "Zsh configuration"; - withPlugins = lib.mkEnableOption "Zsh plugins" // { - default = true; - }; - }; - - config = lib.mkIf cfg.enable { - programs.zsh = lib.mkMerge [ - { - enable = true; - - completionInit = '' - autoload -Uz bashcompinit compinit - local zdump="${config.xdg.cacheHome}/zsh/zdump" - bashcompinit - compinit -d "$zdump" - if [[ ! "$zdump.zwc" -nt "$zdump" ]] - then - zcompile "$zdump" - fi - unset zdump - ''; - - defaultKeymap = "emacs"; - dotDir = ".config/zsh"; - - initExtra = '' - if [[ -r "$XDG_CACHE_HOME/p10k-instant-prompt-*.zsh" ]]; then - source "$XDG_CACHE_HOME/p10k-instant-prompt-*.zsh" - fi - autoload -Uz promptinit colors - promptinit - colors - - zmodload zsh/zutil - zmodload zsh/complist - zstyle ":completion::*" group-name "" - zstyle ":completion:*" menu "select" - zstyle ":completion:*" squeeze-slashes "true" - zstyle ":completion::*" use-cache "true" - zstyle ":completion::*" cache-path "$zdump" - - unsetopt beep - unsetopt hist_beep - unsetopt ignore_braces - unsetopt list_beep - setopt always_to_end - setopt prompt_subst - setopt share_history - - # clear backbuffer with ctrl-l - function clear-screen-and-scrollback() { - echoti civis >"$TTY" - printf '%b' '\e[H\e[2J' >"$TTY" - zle .reset-prompt - zle -R - printf '%b' '\e[3J' >"$TTY" - echoti cnorm >"$TTY" - } - - zle -N clear-screen-and-scrollback - bindkey '^L' clear-screen-and-scrollback - - [[ ! -f ~/.config/zsh/.p10k.zsh ]] || source ~/.config/zsh/.p10k.zsh - ''; - - history = { - expireDuplicatesFirst = true; - path = "${config.xdg.stateHome}/zsh/zsh_history"; - save = 1000; - size = 100; - }; - } - - (lib.mkIf cfg.withPlugins { - plugins = [ - { - name = "nix-zsh-completions"; - src = pkgs.nix-zsh-completions; - file = "share/zsh/plugins/nix/nix-zsh-completions.plugin.zsh"; - } - - { - name = "powerlevel10k"; - src = pkgs.zsh-powerlevel10k; - file = "share/zsh-powerlevel10k/powerlevel10k.zsh-theme"; - } - - { - name = "zsh-autopair"; - src = pkgs.zsh-autopair; - file = "share/zsh/zsh-autopair/autopair.zsh"; - } - - { - name = "zsh-completions"; - src = pkgs.zsh-completions; - file = "share/zsh-completions/zsh-completions.plugin.zsh"; - } - ]; - - autosuggestion.enable = true; - syntaxHighlighting.enable = true; - }) - ]; - }; -} -- cgit v1.2.3