From 983ccd3c2718addec4cb91d6993ca05019138983 Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Thu, 24 Oct 2024 03:13:45 +0100 Subject: [PATCH] feat(version-control/magic): use git-commit-ts-mode Offers more advanced syntax highlighting for commit messages, with support for conventional commit messages. --- modules/version-control/siren-magit.el | 32 ++++++++++++++++++-------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/modules/version-control/siren-magit.el b/modules/version-control/siren-magit.el index ecec2024..5e09fde2 100644 --- a/modules/version-control/siren-magit.el +++ b/modules/version-control/siren-magit.el @@ -10,6 +10,15 @@ (require 'siren-display-line-numbers) (require 'siren-whitespace) +(defun siren-git-commit-mode-setup () + (setq tab-width 4 + fill-column 72) + + (siren-display-fill-column) + (siren-display-line-numbers) + (auto-fill-mode t) + (whitespace-mode t)) + (use-package magit :general ("C-x g" 'magit-status) @@ -47,15 +56,6 @@ (defun siren-magit-mode-setup ()) - (defun siren-git-commit-mode-setup () - (setq tab-width 4 - fill-column 72) - - (siren-display-fill-column) - (siren-display-line-numbers) - (auto-fill-mode t) - (whitespace-mode t)) - :config (when (fboundp 'system-move-file-to-trash) (setq magit-delete-by-moving-to-trash t))) @@ -97,5 +97,19 @@ :hook (git-commit-mode . conventional-commit-setup)) +(use-package git-commit-ts-mode + :mode "\\COMMIT_EDITMSG\\'" + + :hook + (git-ts-commit-setup . siren-git-commit-mode-setup) + + :custom + (git-commit-major-mode 'git-commit-ts-mode) + + :init + (siren-treesit-manual-prepare + 'git-commit-ts-mode + '(gitcommit . ("https://github.com/gbprod/tree-sitter-gitcommit")))) + (provide 'siren-magit) ;;; siren-magit.el ends here