aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitmodules4
-rw-r--r--book/src/generated/lang-support.md1
m---------helix-syntax/languages/tree-sitter-git-config0
-rw-r--r--languages.toml10
-rw-r--r--runtime/queries/git-config/highlights.scm27
5 files changed, 42 insertions, 0 deletions
diff --git a/.gitmodules b/.gitmodules
index e6d9d654..3442652a 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -198,3 +198,7 @@
path = helix-syntax/languages/tree-sitter-make
url = https://github.com/alemuller/tree-sitter-make
shallow = true
+[submodule "helix-syntax/languages/tree-sitter-git-config"]
+ path = helix-syntax/languages/tree-sitter-git-config
+ url = https://github.com/the-mikedavis/tree-sitter-git-config.git
+ shallow = true
diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md
index c093144f..8b599f6b 100644
--- a/book/src/generated/lang-support.md
+++ b/book/src/generated/lang-support.md
@@ -12,6 +12,7 @@
| elixir | ✓ | | | `elixir-ls` |
| fish | ✓ | ✓ | ✓ | |
| git-commit | ✓ | | | |
+| git-config | ✓ | | | |
| git-diff | ✓ | | | |
| git-rebase | ✓ | | | |
| glsl | ✓ | | ✓ | |
diff --git a/helix-syntax/languages/tree-sitter-git-config b/helix-syntax/languages/tree-sitter-git-config
new file mode 160000
+Subproject 0e4f0baf90b57e5aeb62dcdbf03062c6315d43e
diff --git a/languages.toml b/languages.toml
index afee20aa..0a19bb04 100644
--- a/languages.toml
+++ b/languages.toml
@@ -545,3 +545,13 @@ scope = "source.regex"
injection-regex = "regex"
file-types = ["regex"]
roots = []
+
+[[language]]
+name = "git-config"
+scope = "source.gitconfig"
+roots = []
+# TODO: allow specifying file-types as a regex so we can read directory names (e.g. `.git/config`)
+file-types = [".gitmodules", ".gitconfig"]
+injection-regex = "git-config"
+comment-token = "#"
+indent = { tab-width = 4, unit = "\t" }
diff --git a/runtime/queries/git-config/highlights.scm b/runtime/queries/git-config/highlights.scm
new file mode 100644
index 00000000..84767edc
--- /dev/null
+++ b/runtime/queries/git-config/highlights.scm
@@ -0,0 +1,27 @@
+((section_name) @keyword.directive
+ (#eq? @keyword.directive "include"))
+
+((section_header
+ (section_name) @keyword.directive
+ (subsection_name))
+ (#eq? @keyword.directive "includeIf"))
+
+(section_name) @markup.heading
+(variable (name) @variable.other.member)
+[(true) (false)] @constant.builtin.boolean
+(integer) @constant.numeric.integer
+
+((string) @string.special.path
+ (#match? @string.special.path "^(~|./|/)"))
+
+[(string) (subsection_name)] @string
+
+[
+ "["
+ "]"
+ "\""
+] @punctuation.bracket
+
+"=" @punctuation.delimiter
+
+(comment) @comment