Description
One aspect of the standard gitcommit
syntax highlighting present in Vim and Neovim that I particularly love is that it includes built-in rules that follow the 50/72 rule of writing Git commit messages. That is:
- If the commit summary extends beyond 50 characters, the syntax highlighting changes accordingly to gently warn you to shorten it, if you can.
- If the commit message extends beyond 72 characters, the syntax highlighting warns you that GitHub will automatically truncate your message (sometimes mid-word), insert
...
, and overflow the rest into the commit message body, and you should definitely shorten it if you'd like your summary to remain intact.
This is helpful for folks writing commit messages who are looking to keep them nice. For reference, an example of such assistive highlighting in Neovim (using the standard gitcommit.vim
syntax) is shown below:
On the other hand, this is how tree-sitter-gitcommit
(installed via nvim-treesittter
on my machine) highlights the same commit message:
It'd be great if this TS parser could apply similar syntax rules as those used in Vim/Neovim to detect poorly formed commit messages as they're being written, enabling editor color schemes to highlight these malformed sections accordingly. Thanks for maintaining this great open source parser!