kakoune/rc/filetype/mercurial.kak
Nico Sonack f19546a2bb filetype/mercurial: Fix file name regex
The regex for detecting Mercurial's file types was too strict and
didn't catch commit messages.

Relax it to make it detect the commit files properly.
2023-11-16 11:30:07 +01:00

34 lines
834 B
Plaintext

# https://www.mercurial-scm.org/
# ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
# Detection
# ‾‾‾‾‾‾‾‾‾
hook global BufCreate .*hg-editor-.*\.txt$ %{
set-option buffer filetype hg-commit
}
hook global WinSetOption filetype=hg-commit %{
require-module hg-commit
}
hook -group hg-commit-highlight global WinSetOption filetype=hg-commit %{
add-highlighter window/hg-commit ref hg-commit
hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/hg-commit-highlight }
}
provide-module hg-commit %{
# Faces
# ‾‾‾‾‾
set-face global MercurialCommitComment cyan
# Highlighters
# ‾‾‾‾‾‾‾‾‾‾‾‾
add-highlighter shared/hg-commit group
add-highlighter shared/hg-commit/ regex '^HG:[^\n]*' 0:comment
}