aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwzy <32936898+Freed-Wu@users.noreply.github.com>2024-02-20 03:26:32 +0800
committerGitHub <noreply@github.com>2024-02-19 14:26:32 -0500
commite04ce8bcec4dec3551d7ec4fa6d737d183433bfd (patch)
tree801bc090977881e737ddf76bd4f64fb396f4916c
parentci: simplify cache key (diff)
downloadnvim-treesitter-e04ce8bcec4dec3551d7ec4fa6d737d183433bfd.tar
nvim-treesitter-e04ce8bcec4dec3551d7ec4fa6d737d183433bfd.tar.gz
nvim-treesitter-e04ce8bcec4dec3551d7ec4fa6d737d183433bfd.tar.bz2
nvim-treesitter-e04ce8bcec4dec3551d7ec4fa6d737d183433bfd.tar.lz
nvim-treesitter-e04ce8bcec4dec3551d7ec4fa6d737d183433bfd.tar.xz
nvim-treesitter-e04ce8bcec4dec3551d7ec4fa6d737d183433bfd.tar.zst
nvim-treesitter-e04ce8bcec4dec3551d7ec4fa6d737d183433bfd.zip
feat: add tmux parser
-rw-r--r--README.md1
-rw-r--r--lockfile.json3
-rw-r--r--lua/nvim-treesitter/parsers.lua8
-rw-r--r--queries/tmux/highlights.scm52
-rw-r--r--queries/tmux/injections.scm5
5 files changed, 69 insertions, 0 deletions
diff --git a/README.md b/README.md
index 70f5c33b0..0e3987d1c 100644
--- a/README.md
+++ b/README.md
@@ -403,6 +403,7 @@ We are looking for maintainers to add more parsers and to write query files for
- [x] [thrift](https://github.com/duskmoon314/tree-sitter-thrift) (maintained by @amaanq, @duskmoon314)
- [x] [tiger](https://github.com/ambroisie/tree-sitter-tiger) (maintained by @ambroisie)
- [x] [tlaplus](https://github.com/tlaplus-community/tree-sitter-tlaplus) (maintained by @ahelwer, @susliko)
+- [x] [tmux](https://github.com/Freed-Wu/tree-sitter-tmux) (maintained by @Freed-Wu)
- [x] [todotxt](https://github.com/arnarg/tree-sitter-todotxt.git) (experimental, maintained by @arnarg)
- [x] [toml](https://github.com/ikatyang/tree-sitter-toml) (maintained by @tk-shirasaka)
- [x] [tsv](https://github.com/amaanq/tree-sitter-csv) (maintained by @amaanq)
diff --git a/lockfile.json b/lockfile.json
index 22675c886..48f072b09 100644
--- a/lockfile.json
+++ b/lockfile.json
@@ -689,6 +689,9 @@
"tlaplus": {
"revision": "aaf5bb5c1df0a6e583bb51efa519a9ac788b2ad8"
},
+ "tmux": {
+ "revision": "10737f5dc4d8e68c9667f11a6996688a1185755f"
+ },
"todotxt": {
"revision": "3937c5cd105ec4127448651a21aef45f52d19609"
},
diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua
index 2f3654fc5..087f28fc8 100644
--- a/lua/nvim-treesitter/parsers.lua
+++ b/lua/nvim-treesitter/parsers.lua
@@ -1999,6 +1999,14 @@ list.tlaplus = {
maintainers = { "@ahelwer", "@susliko" },
}
+list.tmux = {
+ install_info = {
+ url = "https://github.com/Freed-Wu/tree-sitter-tmux",
+ files = { "src/parser.c" },
+ },
+ maintainers = { "@Freed-Wu" },
+}
+
list.todotxt = {
install_info = {
url = "https://github.com/arnarg/tree-sitter-todotxt.git",
diff --git a/queries/tmux/highlights.scm b/queries/tmux/highlights.scm
new file mode 100644
index 000000000..50da7d7d8
--- /dev/null
+++ b/queries/tmux/highlights.scm
@@ -0,0 +1,52 @@
+; Comments
+(comment) @comment @spell
+
+; General
+[
+ (string)
+ (raw_string)
+] @string
+
+(int) @number
+
+(path) @string.special.path
+
+[
+ (option)
+ (variable_name)
+] @variable
+
+(command_line_option) @variable.builtin
+
+((option) @variable.builtin
+ (#not-lua-match? @variable.builtin "^@"))
+
+(command) @keyword
+
+(source_file_directive
+ (command) @keyword.import)
+
+(attribute) @attribute
+
+(function_name) @function.call
+
+"=" @operator
+
+[
+ ","
+ ":"
+] @punctuation.delimiter
+
+[
+ "#"
+ "?"
+] @punctuation.special
+
+[
+ "#{"
+ "}"
+ "#["
+ "]"
+ "["
+ "{"
+] @punctuation.bracket
diff --git a/queries/tmux/injections.scm b/queries/tmux/injections.scm
new file mode 100644
index 000000000..5bf6e27d2
--- /dev/null
+++ b/queries/tmux/injections.scm
@@ -0,0 +1,5 @@
+((shell) @injection.content
+ (#set! injection.language "bash"))
+
+((comment) @injection.content
+ (#set! injection.language "comment"))