mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17:02 -04:00
Add elvish
This commit is contained in:
parent
a98fa0e222
commit
e06b54b64e
5 changed files with 91 additions and 0 deletions
1
after/ftplugin/elvish.vim
Normal file
1
after/ftplugin/elvish.vim
Normal file
|
|
@ -0,0 +1 @@
|
|||
setlocal commentstring=#\ %s
|
||||
1
ftdetect/elvish.vim
Normal file
1
ftdetect/elvish.vim
Normal file
|
|
@ -0,0 +1 @@
|
|||
autocmd BufRead,BufNewFile *.elv set filetype=elvish
|
||||
|
|
@ -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,
|
||||
|
|
|
|||
79
queries/elvish/highlights.scm
Normal file
79
queries/elvish/highlights.scm
Normal file
|
|
@ -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
|
||||
1
queries/elvish/injections.scm
Normal file
1
queries/elvish/injections.scm
Normal file
|
|
@ -0,0 +1 @@
|
|||
(comment) @comment
|
||||
Loading…
Add table
Add a link
Reference in a new issue