summaryrefslogtreecommitdiff
path: root/autoload/filetype/mercurial.kak
diff options
context:
space:
mode:
authorthing1 <thing1@seacrossedlovers.xyz>2025-01-28 09:14:32 +0000
committerthing1 <thing1@seacrossedlovers.xyz>2025-01-28 09:14:32 +0000
commit904cec3c4a329cf89fc3219d359239910d61f3f6 (patch)
tree8d113899921dfbaca0e77c49ab5fc827362d1091 /autoload/filetype/mercurial.kak
init commitHEADmaster
Diffstat (limited to 'autoload/filetype/mercurial.kak')
-rw-r--r--autoload/filetype/mercurial.kak37
1 files changed, 37 insertions, 0 deletions
diff --git a/autoload/filetype/mercurial.kak b/autoload/filetype/mercurial.kak
new file mode 100644
index 0000000..255b02b
--- /dev/null
+++ b/autoload/filetype/mercurial.kak
@@ -0,0 +1,37 @@
+# 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 regions
+add-highlighter shared/hg-commit/comments region ^HG:\ $ group
+add-highlighter shared/hg-commit/comments/ fill comment
+add-highlighter shared/hg-commit/comments/ regex \
+ "\b(?:(changed)|(removed)|(added)|(bookmark)|(branch)|(user:)) ([^\n]*)$" \
+ 1:yellow 2:red 3:green 4:blue 5:magenta 6:white
+
+}