aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmaan Qureshi <amaanq12@gmail.com>2023-03-09 18:07:54 -0500
committerAmaan Qureshi <amaanq12@gmail.com>2023-03-10 03:00:55 -0500
commit0db1cc348eec72788d8424add78910ee218f6516 (patch)
treed2ad914df673d3308d9af595099b790e27dc087c
parentUpdate README (diff)
downloadnvim-treesitter-0db1cc348eec72788d8424add78910ee218f6516.tar
nvim-treesitter-0db1cc348eec72788d8424add78910ee218f6516.tar.gz
nvim-treesitter-0db1cc348eec72788d8424add78910ee218f6516.tar.bz2
nvim-treesitter-0db1cc348eec72788d8424add78910ee218f6516.tar.lz
nvim-treesitter-0db1cc348eec72788d8424add78910ee218f6516.tar.xz
nvim-treesitter-0db1cc348eec72788d8424add78910ee218f6516.tar.zst
nvim-treesitter-0db1cc348eec72788d8424add78910ee218f6516.zip
feat: add gitconfig
-rw-r--r--README.md1
-rw-r--r--lockfile.json3
-rw-r--r--lua/nvim-treesitter/parsers.lua10
-rw-r--r--queries/git_config/folds.scm0
-rw-r--r--queries/git_config/highlights.scm46
5 files changed, 60 insertions, 0 deletions
diff --git a/README.md b/README.md
index ed5736bd2..89267d626 100644
--- a/README.md
+++ b/README.md
@@ -223,6 +223,7 @@ We are looking for maintainers to add more parsers and to write query files for
- [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] [gitconfig](https://github.com/the-mikedavis/tree-sitter-git-config) (maintained by @amaanq)
- [x] [gitignore](https://github.com/shunsambongi/tree-sitter-gitignore) (maintained by @theHamsta)
- [x] [gleam](https://github.com/gleam-lang/tree-sitter-gleam) (maintained by @amaanq)
- [x] [Glimmer and Ember](https://github.com/alexlafroscia/tree-sitter-glimmer) (maintained by @NullVoxPopuli)
diff --git a/lockfile.json b/lockfile.json
index ff5dbd483..99fbb2205 100644
--- a/lockfile.json
+++ b/lockfile.json
@@ -149,6 +149,9 @@
"gitcommit": {
"revision": "f71b93f399c9c2b315825827c95466e7405ec622"
},
+ "git_config": {
+ "revision": "a01b498b25003d97a5f93b0da0e6f28307454347"
+ },
"gitignore": {
"revision": "f4685bf11ac466dd278449bcfe5fd014e94aa504"
},
diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua
index 235e2a094..e36d6cdec 100644
--- a/lua/nvim-treesitter/parsers.lua
+++ b/lua/nvim-treesitter/parsers.lua
@@ -516,6 +516,16 @@ list.gitcommit = {
maintainers = { "@gbprod" },
}
+list.git_config = {
+ install_info = {
+ url = "https://github.com/the-mikedavis/tree-sitter-git-config",
+ files = { "src/parser.c" },
+ },
+ filetype = "gitconfig",
+ maintainers = { "@amaanq" },
+ readme_name = "gitconfig",
+}
+
list.gitignore = {
install_info = {
url = "https://github.com/shunsambongi/tree-sitter-gitignore",
diff --git a/queries/git_config/folds.scm b/queries/git_config/folds.scm
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/queries/git_config/folds.scm
diff --git a/queries/git_config/highlights.scm b/queries/git_config/highlights.scm
new file mode 100644
index 000000000..9172e890c
--- /dev/null
+++ b/queries/git_config/highlights.scm
@@ -0,0 +1,46 @@
+; Sections
+
+(section_name) @type
+
+((section_name) @include
+ (#eq? @include "include"))
+
+((section_header
+ (section_name) @include
+ (subsection_name))
+ (#eq? @include "includeIf"))
+
+(variable (name) @property)
+
+; Operators
+
+[
+ "="
+] @operator
+
+; Literals
+
+(integer) @number
+[
+ (true)
+ (false)
+] @boolean
+
+(string) @string
+
+((string) @text.uri
+ (#match? @text.uri "^(~|./|/)"))
+
+(section_header
+ [
+ "\""
+ (subsection_name)
+ ] @string.special)
+
+; Punctuation
+
+[ "[" "]" ] @punctuation.bracket
+
+; Comments
+
+(comment) @comment @spell