diff options
| author | Thomas Vigouroux <tomvig38@gmail.com> | 2021-04-18 09:57:02 +0200 |
|---|---|---|
| committer | Stephan Seitz <stephan.seitz@fau.de> | 2021-09-17 21:06:36 +0200 |
| commit | 1877e03bfae876debf028a7605b9cc8d7c6fed86 (patch) | |
| tree | 01c38bbb969910c07da22299f3dbe605d6aa9fbb /queries | |
| parent | Lua: highlight uppercase variables as constants (#1690) (diff) | |
| download | nvim-treesitter-1877e03bfae876debf028a7605b9cc8d7c6fed86.tar nvim-treesitter-1877e03bfae876debf028a7605b9cc8d7c6fed86.tar.gz nvim-treesitter-1877e03bfae876debf028a7605b9cc8d7c6fed86.tar.bz2 nvim-treesitter-1877e03bfae876debf028a7605b9cc8d7c6fed86.tar.lz nvim-treesitter-1877e03bfae876debf028a7605b9cc8d7c6fed86.tar.xz nvim-treesitter-1877e03bfae876debf028a7605b9cc8d7c6fed86.tar.zst nvim-treesitter-1877e03bfae876debf028a7605b9cc8d7c6fed86.zip | |
feat: add support for vim
Diffstat (limited to 'queries')
| -rw-r--r-- | queries/vim/highlights.scm | 105 | ||||
| -rw-r--r-- | queries/vim/injections.scm | 9 |
2 files changed, 114 insertions, 0 deletions
diff --git a/queries/vim/highlights.scm b/queries/vim/highlights.scm new file mode 100644 index 000000000..e10983d4f --- /dev/null +++ b/queries/vim/highlights.scm @@ -0,0 +1,105 @@ +;; Keywords + +[ + "if" + "else" + "elseif" + "endif" +] @conditional + +[ + "try" + "catch" + "finally" + "endtry" + "throw" +] @exception + +[ + "for" + "endfor" + "in" + "while" + "endwhile" +] @repeat + +[ + "function" + "endfunction" +] @keyword.function + +;; Function related +(function_declaration name: (_) @function) +(call_expression function: (identifier) @function) + +[ (bang) (spread) ] @punctuation.special + +[ (no_option) (inv_option) (default_option) (option_name) ] @variable.builtin +[ (scope) "a:" ] @namespace + +(ternary_expression ["?" ":"] @conditional) + +;; Commands and user defined commands + +[ + "let" + "unlet" + "call" + "execute" + "normal" + "set" + "silent" + "echo" + "autocmd" + "return" + "lua" + "ruby" + "perl" + "python" +] @keyword +(command_name) @function.macro + +(au_event) @constant +(normal_statement (commands) @constant) + +;; Literals + +(string_literal) @string +(integer_literal) @number +(float_literal) @float +(comment) @comment +(pattern) @string.special + +;; Operators + +[ + "||" + "&&" + "+" + "-" + "*" + "/" + "%" + ".." + "is" + "isnot" + "==" + "!=" + ">" + ">=" + "<" + "<=" + "=~" + "!~" + "=" + "+=" + "-=" + "*=" + "/=" + "%=" + ".=" +] @operator + +; Some characters have different meanings based on the context +(unary_operation "!" @operator) +(binary_operation "." @operator) diff --git a/queries/vim/injections.scm b/queries/vim/injections.scm new file mode 100644 index 000000000..de70ef169 --- /dev/null +++ b/queries/vim/injections.scm @@ -0,0 +1,9 @@ +(lua_statement . (_) @lua) +(ruby_statement . (_) @ruby) +(python_statement . (_) @python) +;; If we support perl at some point... +;; (perl_statement . (_) @perl) + +(autocmd_statement (pattern) @regex) + +(comment) @comment |
