Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/danilshvalov/git-commit-ts-mode

A tree-sitter based major mode for editing Git commit messages in GNU Emacs.
https://github.com/danilshvalov/git-commit-ts-mode

emacs git tree-sitter

Last synced: 29 days ago
JSON representation

A tree-sitter based major mode for editing Git commit messages in GNU Emacs.

Awesome Lists containing this project

README

        

# git-commit-ts-mode

A tree-sitter based major mode for editing Git commit messages in GNU Emacs.

![git-commit-ts-mode](https://github.com/danilshvalov/git-commit-ts-mode/assets/57654917/b5292190-651d-4794-abe1-6ac9702142ec)

## Quick start

### Grammar installation

Evaluate the Lisp code below:

```elisp
(add-to-list 'treesit-language-source-alist
'(gitcommit . ("https://github.com/gbprod/tree-sitter-gitcommit")))
```

Running `M-x treesit-install-language-grammar [RET] gitcommit` will compile and
install the latest [tree-sitter-gitcommit](https://github.com/gbprod/tree-sitter-gitcommit).

### Package installation

If you use [elpaca](https://github.com/progfolio/elpaca) and [use-package](https://github.com/jwiegley/use-package) to manage packages in Emacs, use the following code to install `git-commit-ts-mode`:

```elisp
(use-package git-commit-ts-mode
:elpaca (git-commit-ts-mode :host github
:repo "danilshvalov/git-commit-ts-mode")
:mode "\\COMMIT_EDITMSG\\'")
```

## Configuration

### Max commit message size

To specify the maximum allowed message size, use the `git-commit-ts-max-message-size` variable (default value is 72). If the specified limit is exceeded, the rest of the message will be highlighted using `git-commit-ts-overflow-face`.

### Magit integration

To use `git-commit-ts-mode` in the Magit commit buffer, you need to change the value of the `git-commit-major-mode` variable, for example, as follows:

```elisp
(setq git-commit-major-mode 'git-commit-ts-mode)
```