diff --git a/modules/lang/sh/config.el b/modules/lang/sh/config.el index 3e64a59f4..ed0f1c5da 100644 --- a/modules/lang/sh/config.el +++ b/modules/lang/sh/config.el @@ -34,14 +34,16 @@ ;; 1. Fontifies variables in double quotes ;; 2. Fontify command substitution in double quotes ;; 3. Fontify built-in/common commands (see `+sh-builtin-keywords') - (font-lock-add-keywords - 'sh-mode `((+sh--match-variables-in-quotes - (1 'font-lock-constant-face prepend) - (2 'font-lock-variable-name-face prepend)) - (+sh--match-command-subst-in-quotes - (1 'sh-quoted-exec prepend)) - (,(regexp-opt +sh-builtin-keywords 'words) - (0 'font-lock-type-face append)))) + (defun +sh|init-extra-fontification () + (font-lock-add-keywords + nil `((+sh--match-variables-in-quotes + (1 'font-lock-constant-face prepend) + (2 'font-lock-variable-name-face prepend)) + (+sh--match-command-subst-in-quotes + (1 'sh-quoted-exec prepend)) + (,(regexp-opt +sh-builtin-keywords 'words) + (0 'font-lock-type-face append))))) + (add-hook 'sh-mode-hook #'+sh|init-extra-fontification) ;; 4. Fontify delimiters by depth (add-hook 'sh-mode-hook #'rainbow-delimiters-mode)