Skip to content

Commit

Permalink
feat(version-control/magic): use git-commit-ts-mode
Browse files Browse the repository at this point in the history
Offers more advanced syntax highlighting for commit messages, with
support for conventional commit messages.
  • Loading branch information
jimeh committed Oct 24, 2024
1 parent 3edd8e6 commit 983ccd3
Showing 1 changed file with 23 additions and 9 deletions.
32 changes: 23 additions & 9 deletions modules/version-control/siren-magit.el
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)))
Expand Down Expand Up @@ -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

0 comments on commit 983ccd3

Please sign in to comment.