aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgbprod <contact@gb-prod.fr>2022-11-24 08:54:54 +0100
committerStephan Seitz <stephan.seitz@fau.de>2022-11-24 12:26:02 +0100
commit118a87f7e7fecd91c3661c29d4014d529a27b86d (patch)
tree691f2b1babedc495e1bd1a0bb787ae43be5066b1
parentfix(fish): "test" command capture name (diff)
downloadnvim-treesitter-118a87f7e7fecd91c3661c29d4014d529a27b86d.tar
nvim-treesitter-118a87f7e7fecd91c3661c29d4014d529a27b86d.tar.gz
nvim-treesitter-118a87f7e7fecd91c3661c29d4014d529a27b86d.tar.bz2
nvim-treesitter-118a87f7e7fecd91c3661c29d4014d529a27b86d.tar.lz
nvim-treesitter-118a87f7e7fecd91c3661c29d4014d529a27b86d.tar.xz
nvim-treesitter-118a87f7e7fecd91c3661c29d4014d529a27b86d.tar.zst
nvim-treesitter-118a87f7e7fecd91c3661c29d4014d529a27b86d.zip
feat: add gitcommit parser
-rw-r--r--README.md1
-rw-r--r--lua/nvim-treesitter/parsers.lua9
-rw-r--r--queries/gitcommit/highlights.scm33
-rw-r--r--queries/gitcommit/injections.scm2
4 files changed, 45 insertions, 0 deletions
diff --git a/README.md b/README.md
index a72c5e20b..5c49edf80 100644
--- a/README.md
+++ b/README.md
@@ -210,6 +210,7 @@ We are looking for maintainers to add more parsers and to write query files for
- [x] [Godot (gdscript)](https://github.com/PrestonKnopp/tree-sitter-gdscript) (maintained by @Shatur95)
- [x] [git_rebase](https://github.com/the-mikedavis/tree-sitter-git-rebase) (maintained by @gbprod)
- [x] [gitattributes](https://github.com/ObserverOfTime/tree-sitter-gitattributes) (maintained by @ObserverOfTime)
+- [x] [gitcommit](https://github.com/gbprod/tree-sitter-gitcommit) (maintained by @gbprod)
- [x] [gitignore](https://github.com/shunsambongi/tree-sitter-gitignore) (maintained by @theHamsta)
- [x] [gleam](https://github.com/J3RN/tree-sitter-gleam) (maintained by @connorlay)
- [x] [Glimmer and Ember](https://github.com/alexlafroscia/tree-sitter-glimmer) (maintained by @alexlafroscia)
diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua
index 0c22f27b2..2844e8e38 100644
--- a/lua/nvim-treesitter/parsers.lua
+++ b/lua/nvim-treesitter/parsers.lua
@@ -1253,6 +1253,15 @@ list.git_rebase = {
maintainers = { "@gbprod" },
}
+list.gitcommit = {
+ install_info = {
+ url = "https://github.com/gbprod/tree-sitter-gitcommit",
+ files = { "src/parser.c", "src/scanner.c" },
+ branch = "main",
+ },
+ maintainers = { "@gbprod" },
+}
+
list.blueprint = {
install_info = {
url = "https://gitlab.com/gabmus/tree-sitter-blueprint.git",
diff --git a/queries/gitcommit/highlights.scm b/queries/gitcommit/highlights.scm
new file mode 100644
index 000000000..c44428b0a
--- /dev/null
+++ b/queries/gitcommit/highlights.scm
@@ -0,0 +1,33 @@
+(comment) @comment
+(generated_comment) @comment
+(title) @text.title
+(text) @text
+(branch) @text.reference
+(change) @keyword
+(filepath) @text.uri
+(arrow) @punctuation.delimiter
+
+(subject) @text.title
+(subject (overflow) @text)
+(prefix (type) @keyword)
+(prefix (scope) @parameter)
+(prefix [
+ "("
+ ")"
+ ":"
+] @punctuation.delimiter)
+(prefix [
+ "!"
+] @punctuation.special)
+
+(message) @text
+
+(trailer (token) @label)
+(trailer (value) @text)
+
+(breaking_change (token) @text.warning)
+(breaking_change (value) @text)
+
+(scissor) @comment
+
+(ERROR) @error
diff --git a/queries/gitcommit/injections.scm b/queries/gitcommit/injections.scm
new file mode 100644
index 000000000..4da902920
--- /dev/null
+++ b/queries/gitcommit/injections.scm
@@ -0,0 +1,2 @@
+(diff) @diff
+(rebase_command) @git_rebase