diff options
| author | Tobias Frilling <tobias@frilling.dev> | 2022-03-26 18:27:11 +0100 |
|---|---|---|
| committer | Stephan Seitz <stephan.seitz@fau.de> | 2022-04-01 09:51:42 +0200 |
| commit | e06b54b64ebf415b27fc862a8d2d39eb20c2c69e (patch) | |
| tree | d77c9b3ebf429a4171010acc949708f71c4829cd | |
| parent | Update lockfile.json (diff) | |
| download | nvim-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
| -rw-r--r-- | after/ftplugin/elvish.vim | 1 | ||||
| -rw-r--r-- | ftdetect/elvish.vim | 1 | ||||
| -rw-r--r-- | lua/nvim-treesitter/parsers.lua | 9 | ||||
| -rw-r--r-- | queries/elvish/highlights.scm | 79 | ||||
| -rw-r--r-- | queries/elvish/injections.scm | 1 |
5 files changed, 91 insertions, 0 deletions
diff --git a/after/ftplugin/elvish.vim b/after/ftplugin/elvish.vim new file mode 100644 index 000000000..463eea989 --- /dev/null +++ b/after/ftplugin/elvish.vim @@ -0,0 +1 @@ +setlocal commentstring=#\ %s diff --git a/ftdetect/elvish.vim b/ftdetect/elvish.vim new file mode 100644 index 000000000..be94b7790 --- /dev/null +++ b/ftdetect/elvish.vim @@ -0,0 +1 @@ +autocmd BufRead,BufNewFile *.elv set filetype=elvish diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua index d767095c3..4784c476d 100644 --- a/lua/nvim-treesitter/parsers.lua +++ b/lua/nvim-treesitter/parsers.lua @@ -987,6 +987,15 @@ list.cooklang = { maintainers = { "@addcninblue" }, } +list.elvish = { + install_info = { + url = "https://github.com/ckafi/tree-sitter-elvish", + branch = "main", + files = { "src/parser.c" }, + }, + maintainers = { "@ckafi" }, +} + local M = { list = list, filetype_to_parsername = filetype_to_parsername, 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 |
