From 8160b3b45b8457d58d2b3af2aeb2eb6f47042e0f Mon Sep 17 00:00:00 2001 From: Maxime Brunet Date: Thu, 7 Jul 2022 17:57:27 -0700 Subject: [PATCH] zsh: source zsh-syntax-highlighting at the end of .zshrc (#3068) zsh-syntax-highlighting.zsh must be sourced at the end of the .zshrc file, otherwise widgets created after are not properly highlighted (e.g. from oh-my-zsh): https://github.com/zsh-users/zsh-syntax-highlighting#faq --- modules/programs/zsh.nix | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/modules/programs/zsh.nix b/modules/programs/zsh.nix index 2d81698b6..133b1c320 100644 --- a/modules/programs/zsh.nix +++ b/modules/programs/zsh.nix @@ -500,10 +500,6 @@ in "source ${pkgs.zsh-autosuggestions}/share/zsh-autosuggestions/zsh-autosuggestions.zsh" } - ${optionalString cfg.enableSyntaxHighlighting - "source ${pkgs.zsh-syntax-highlighting}/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" - } - ${optionalString cfg.oh-my-zsh.enable '' # oh-my-zsh extra settings for plugins ${cfg.oh-my-zsh.extraConfig} @@ -557,6 +553,12 @@ in # Named Directory Hashes ${dirHashesStr} + + ${optionalString cfg.enableSyntaxHighlighting + # Load zsh-syntax-highlighting last, after all custom widgets have been created + # https://github.com/zsh-users/zsh-syntax-highlighting#faq + "source ${pkgs.zsh-syntax-highlighting}/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" + } ''; }