aboutsummaryrefslogtreecommitdiff
path: root/runtime/queries/git-commit
diff options
context:
space:
mode:
authorMichael Davis2021-12-24 22:49:27 +0000
committerBlaž Hrastnik2021-12-25 15:12:49 +0000
commitc3fb86cbaa5c6973fe014a4401c4e0d6f663384d (patch)
tree65af5d4b1a847a7c5ae8c4c0dfde9190e674baa1 /runtime/queries/git-commit
parent28c9afdd0e83da37c782fc82b859d8451df1b877 (diff)
tree-sitter-gitcommit->tree-sitter-git-commit
Diffstat (limited to 'runtime/queries/git-commit')
-rw-r--r--runtime/queries/git-commit/highlights.scm18
-rw-r--r--runtime/queries/git-commit/injections.scm15
2 files changed, 33 insertions, 0 deletions
diff --git a/runtime/queries/git-commit/highlights.scm b/runtime/queries/git-commit/highlights.scm
new file mode 100644
index 00000000..04d70416
--- /dev/null
+++ b/runtime/queries/git-commit/highlights.scm
@@ -0,0 +1,18 @@
+(subject) @markup.heading
+(path) @string.special.path
+(branch) @string.special.symbol
+(commit) @constant
+(item) @markup.link.url
+(header) @tag
+
+(change kind: "new file" @diff.plus)
+(change kind: "deleted" @diff.minus)
+(change kind: "modified" @diff.delta)
+(change kind: "renamed" @diff.delta.moved)
+
+[":" "->"] @punctuation.delimeter
+(comment) @comment
+
+; once we have diff injections, @comment should become @none
+((comment (scissors))
+ (message)+ @comment)
diff --git a/runtime/queries/git-commit/injections.scm b/runtime/queries/git-commit/injections.scm
new file mode 100644
index 00000000..2837a586
--- /dev/null
+++ b/runtime/queries/git-commit/injections.scm
@@ -0,0 +1,15 @@
+; once a diff grammar is available, we can inject diff highlighting into the
+; trailer after scissors (git commit --verbose)
+; see https://github.com/helix-editor/helix/pull/1338#issuecomment-1000013539
+;
+; ((comment (scissors))
+; (message) @injection.content
+; (#set! injection.language "diff"))
+
+; ---
+
+; once a rebase grammar is available, we can inject rebase highlighting into
+; interactive rebase summary sections like so:
+;
+; ((rebase_command) @injection.content
+; (#set! injection.language "git-rebase"))