aboutsummaryrefslogtreecommitdiffstats
path: root/queries/elvish
diff options
context:
space:
mode:
authorTobias Frilling <tobias@frilling.dev>2022-03-26 18:27:11 +0100
committerStephan Seitz <stephan.seitz@fau.de>2022-04-01 09:51:42 +0200
commite06b54b64ebf415b27fc862a8d2d39eb20c2c69e (patch)
treed77c9b3ebf429a4171010acc949708f71c4829cd /queries/elvish
parentUpdate lockfile.json (diff)
downloadnvim-treesitter-e06b54b64ebf415b27fc862a8d2d39eb20c2c69e.tar
nvim-treesitter-e06b54b64ebf415b27fc862a8d2d39eb20c2c69e.tar.gz
nvim-treesitter-e06b54b64ebf415b27fc862a8d2d39eb20c2c69e.tar.bz2
nvim-treesitter-e06b54b64ebf415b27fc862a8d2d39eb20c2c69e.tar.lz
nvim-treesitter-e06b54b64ebf415b27fc862a8d2d39eb20c2c69e.tar.xz
nvim-treesitter-e06b54b64ebf415b27fc862a8d2d39eb20c2c69e.tar.zst
nvim-treesitter-e06b54b64ebf415b27fc862a8d2d39eb20c2c69e.zip
Add elvish
Diffstat (limited to 'queries/elvish')
-rw-r--r--queries/elvish/highlights.scm79
-rw-r--r--queries/elvish/injections.scm1
2 files changed, 80 insertions, 0 deletions
diff --git a/queries/elvish/highlights.scm b/queries/elvish/highlights.scm
new file mode 100644
index 000000000..40637ae8a
--- /dev/null
+++ b/queries/elvish/highlights.scm
@@ -0,0 +1,79 @@
+(comment) @comment
+
+(if "if" @conditional)
+(if (elif "elif" @conditional))
+(if (else "else" @conditional))
+
+(while "while" @repeat)
+(while (else "else" @repeat))
+(for "for" @repeat)
+(for (else "else" @repeat))
+
+(try "try" @exception)
+(try (catch "catch" @exception))
+(try (else "else" @exception))
+(try (finally "finally" @exception))
+
+(import "use" @include)
+(import (bareword) @string.special)
+
+(wildcard ["*" "**" "?"] @string.special)
+
+(command argument: (bareword) @parameter)
+(command head: (identifier) @function)
+((command head: (identifier) @keyword.return)
+ (#eq? @keyword.return "return"))
+((command (identifier) @keyword.operator)
+ (#any-of? @keyword.operator "and" "or" "coalesce"))
+((command head: _ @function)
+ (#any-of? @function
+ "+" "-" "*" "/" "%" "<" "<=""==" "!=" ">"
+ ">=" "<s" "<=s" "==s" "!=s" ">s" ">=s"
+))
+
+(pipeline "|" @operator)
+(redirection [">" "<" ">>" "<>"] @operator)
+
+(io_port) @number
+
+(function_definition
+ "fn" @keyword.function
+ (identifier) @function)
+
+(parameter_list) @parameter
+(parameter_list "|" @punctuation.bracket)
+
+(variable_declaration
+ "var" @keyword
+ (lhs (identifier) @variable))
+
+(variable_assignment
+ "set" @keyword
+ (lhs (identifier) @variable))
+
+(temporary_assignment
+ "tmp" @keyword
+ (lhs (identifier) @variable))
+
+(variable_deletion
+ "del" @keyword
+ (identifier) @variable)
+
+
+(number) @number
+(string) @string
+
+(variable (identifier) @variable)
+((variable (identifier) @function)
+ (#match? @function ".+\\~$"))
+((variable (identifier) @boolean)
+ (#any-of? @boolean "true" "false"))
+((variable (identifier) @constant.builtin)
+ (#any-of? @constant.builtin
+ "_" "after-chdir" "args" "before-chdir" "buildinfo" "nil"
+ "notify-bg-job-success" "num-bg-jobs" "ok" "paths" "pid"
+ "pwd" "value-out-indicator" "version"))
+
+["$" "@"] @punctuation.special
+["(" ")" "[" "]" "{" "}"] @punctuation.bracket
+";" @punctuation.delimiter
diff --git a/queries/elvish/injections.scm b/queries/elvish/injections.scm
new file mode 100644
index 000000000..4bb7d675d
--- /dev/null
+++ b/queries/elvish/injections.scm
@@ -0,0 +1 @@
+(comment) @comment