From ef2f0d91ea4c8981276136f7f114f9dcb4858ba1 Mon Sep 17 00:00:00 2001 From: XYenon Date: Thu, 2 May 2024 07:53:50 +0800 Subject: [PATCH] feat(home-manager): add support for zsh-syntax-highlighting (#146) Co-authored-by: seth --- _sources/generated.json | 20 +++++++++++++++++++ _sources/generated.nix | 12 +++++++++++ .../home-manager/zsh-syntax-highlighting.nix | 20 +++++++++++++++++++ nvfetcher.toml | 4 ++++ test.nix | 3 +++ 5 files changed, 59 insertions(+) create mode 100644 modules/home-manager/zsh-syntax-highlighting.nix diff --git a/_sources/generated.json b/_sources/generated.json index 36155fe..872ae15 100644 --- a/_sources/generated.json +++ b/_sources/generated.json @@ -718,5 +718,25 @@ "type": "github" }, "version": "0adc53028d81bf047461bc61c43a484d11b15220" + }, + "zsh-syntax-highlighting": { + "cargoLocks": null, + "date": "2022-10-12", + "extract": null, + "name": "zsh-syntax-highlighting", + "passthru": null, + "pinned": false, + "src": { + "deepClone": false, + "fetchSubmodules": false, + "leaveDotGit": false, + "name": null, + "owner": "catppuccin", + "repo": "zsh-syntax-highlighting", + "rev": "06d519c20798f0ebe275fc3a8101841faaeee8ea", + "sha256": "sha256-Q7KmwUd9fblprL55W0Sf4g7lRcemnhjh4/v+TacJSfo=", + "type": "github" + }, + "version": "06d519c20798f0ebe275fc3a8101841faaeee8ea" } } diff --git a/_sources/generated.nix b/_sources/generated.nix index a9e575d..9b88394 100644 --- a/_sources/generated.nix +++ b/_sources/generated.nix @@ -433,4 +433,16 @@ }; date = "2024-04-04"; }; + zsh-syntax-highlighting = { + pname = "zsh-syntax-highlighting"; + version = "06d519c20798f0ebe275fc3a8101841faaeee8ea"; + src = fetchFromGitHub { + owner = "catppuccin"; + repo = "zsh-syntax-highlighting"; + rev = "06d519c20798f0ebe275fc3a8101841faaeee8ea"; + fetchSubmodules = false; + sha256 = "sha256-Q7KmwUd9fblprL55W0Sf4g7lRcemnhjh4/v+TacJSfo="; + }; + date = "2022-10-12"; + }; } diff --git a/modules/home-manager/zsh-syntax-highlighting.nix b/modules/home-manager/zsh-syntax-highlighting.nix new file mode 100644 index 0000000..c849c90 --- /dev/null +++ b/modules/home-manager/zsh-syntax-highlighting.nix @@ -0,0 +1,20 @@ +{ config +, lib +, sources +, ... +}: +let + inherit (lib) ctp; + cfg = config.programs.zsh.syntaxHighlighting.catppuccin; + enable = cfg.enable && config.programs.zsh.syntaxHighlighting.enable; +in +{ + options.programs.zsh.syntaxHighlighting.catppuccin = + ctp.mkCatppuccinOpt "zsh syntax highlighting"; + + config.programs.zsh = lib.mkIf enable { + initExtra = lib.mkBefore '' + source '${sources.zsh-syntax-highlighting}/themes/catppuccin_${cfg.flavour}-zsh-syntax-highlighting.zsh' + ''; + }; +} diff --git a/nvfetcher.toml b/nvfetcher.toml index fa7e43b..8485978 100644 --- a/nvfetcher.toml +++ b/nvfetcher.toml @@ -141,3 +141,7 @@ fetch.github = "catppuccin/yazi" [zathura] src.git = "https://github.com/catppuccin/zathura.git" fetch.github = "catppuccin/zathura" + +[zsh-syntax-highlighting] +src.git = "https://github.com/catppuccin/zsh-syntax-highlighting.git" +fetch.github = "catppuccin/zsh-syntax-highlighting" diff --git a/test.nix b/test.nix index 8b3d94b..ab577db 100644 --- a/test.nix +++ b/test.nix @@ -88,6 +88,9 @@ testers.runNixOSTest { yazi = enable; zathura = enable; zellij = enable; + zsh = enable // { + syntaxHighlighting = enable; + }; }; gtk = lib.recursiveUpdate enable { catppuccin.cursor.enable = true; };