From 432ac8400b8590cb648f56a89dee3ad372d29955 Mon Sep 17 00:00:00 2001 From: Minijackson Date: Sat, 3 Aug 2024 14:11:43 +0200 Subject: common/zsh: switch to fast-syntax-highlighting --- common/commandline/zsh.nix | 86 +++++++++++++++++++++++++--------------------- 1 file changed, 46 insertions(+), 40 deletions(-) diff --git a/common/commandline/zsh.nix b/common/commandline/zsh.nix index 9f05386..17504e9 100644 --- a/common/commandline/zsh.nix +++ b/common/commandline/zsh.nix @@ -1,4 +1,5 @@ -inputs: { +inputs: +{ config, lib, pkgs, @@ -7,7 +8,8 @@ inputs: { let inherit (inputs.self.lib.theme) fgEscapeCode; dominantEscapeCode = fgEscapeCode config.theme.colors.dominant; -in { +in +{ programs.zsh = { enable = true; @@ -28,10 +30,11 @@ in { } # Grml's ZSH config overrides less variables - export ${lib.concatStringsSep " " - (lib.mapAttrsToList - (variable: value: "${variable}=\"${value}\"") - config.programs.less.envVariables)} + export ${ + lib.concatStringsSep " " ( + lib.mapAttrsToList (variable: value: "${variable}=\"${value}\"") config.programs.less.envVariables + ) + } ''; # otherwise it'll override the grml prompt @@ -39,11 +42,6 @@ in { # Grml handles that, and supports cache (faster!!!) enableGlobalCompInit = false; - syntaxHighlighting = { - enable = true; - highlighters = ["main" "brackets" "line"]; - }; - shellAliases = { e = "\${(z)EDITOR}"; # Space at the end makes Zsh expand aliases after "sudo" @@ -59,35 +57,43 @@ in { users.defaultUserShell = pkgs.zsh; home-manager.sharedModules = [ - ({config, ...}: { - programs.zsh = { - enable = true; - # Completion is already handled by the GRML conf - enableCompletion = false; - - history = { - extended = true; - expireDuplicatesFirst = true; - ignoreDups = true; - ignorePatterns = ["run-help *"]; - - # different, for expireDuplicatesFirst - size = 1100; - save = 1000; + ( + { config, ... }: + { + programs.zsh = { + enable = true; + # Completion is already handled by the GRML conf + enableCompletion = false; + + history = { + extended = true; + expireDuplicatesFirst = true; + ignoreDups = true; + ignorePatterns = [ "run-help *" ]; + + # different, for expireDuplicatesFirst + size = 1100; + save = 1000; + }; + + # XDG + dotDir = ".config/zsh"; + history.path = "${config.xdg.dataHome}/zsh/zsh_history"; + + plugins = [ + { + name = "shmart-prompt-dir"; + src = inputs.shmart-prompt-dir; + file = "none"; + } + + { + name = "fast-syntax-highlighting"; + src = "${pkgs.unstable.zsh-fast-syntax-highlighting}/share/zsh/site-functions"; + } + ]; }; - - # XDG - dotDir = ".config/zsh"; - history.path = "${config.xdg.dataHome}/zsh/zsh_history"; - - plugins = [ - { - name = "shmart-prompt-dir"; - src = inputs.shmart-prompt-dir; - file = "none"; - } - ]; - }; - }) + } + ) ]; } -- cgit v1.2.3