diff options
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/queries/c/highlights.scm | 2 | ||||
-rw-r--r-- | runtime/queries/go/highlights.scm | 39 | ||||
-rw-r--r-- | runtime/queries/go/locals.scm | 30 | ||||
-rw-r--r-- | runtime/queries/haskell/highlights.scm | 14 | ||||
-rw-r--r-- | runtime/queries/javascript/highlights.scm | 2 | ||||
-rw-r--r-- | runtime/queries/julia/highlights.scm | 82 | ||||
-rw-r--r-- | runtime/queries/latex/highlights.scm | 4 | ||||
-rw-r--r-- | runtime/queries/ledger/injections.scm | 1 | ||||
-rw-r--r-- | runtime/queries/lua/highlights.scm | 18 | ||||
-rw-r--r-- | runtime/queries/ocaml/highlights.scm | 8 | ||||
-rw-r--r-- | runtime/queries/ruby/highlights.scm | 2 | ||||
-rw-r--r-- | runtime/queries/rust/highlights.scm | 4 | ||||
-rw-r--r-- | runtime/queries/rust/locals.scm | 17 | ||||
-rw-r--r-- | runtime/queries/svelte/highlights.scm | 68 | ||||
-rw-r--r-- | runtime/queries/svelte/indents.toml | 18 | ||||
-rw-r--r-- | runtime/queries/svelte/injections.scm | 30 | ||||
-rw-r--r-- | runtime/queries/tsx/highlights.scm | 1 | ||||
-rw-r--r-- | runtime/queries/yaml/highlights.scm | 2 | ||||
-rw-r--r-- | runtime/themes/dark_plus.toml | 3 | ||||
-rw-r--r-- | runtime/themes/everforest_dark.toml | 87 | ||||
-rw-r--r-- | runtime/themes/monokai.toml | 1 |
21 files changed, 362 insertions, 71 deletions
diff --git a/runtime/queries/c/highlights.scm b/runtime/queries/c/highlights.scm index 258e07e7..2c42710f 100644 --- a/runtime/queries/c/highlights.scm +++ b/runtime/queries/c/highlights.scm @@ -61,7 +61,7 @@ (null) @constant (number_literal) @number -(char_literal) @number +(char_literal) @string (call_expression function: (identifier) @function) diff --git a/runtime/queries/go/highlights.scm b/runtime/queries/go/highlights.scm index 224c8b78..3129c4b2 100644 --- a/runtime/queries/go/highlights.scm +++ b/runtime/queries/go/highlights.scm @@ -17,9 +17,18 @@ ; Identifiers +((identifier) @constant (match? @constant "^[A-Z][A-Z\\d_]+$")) +(const_spec + name: (identifier) @constant) + +(parameter_declaration (identifier) @variable.parameter) +(variadic_parameter_declaration (identifier) @variable.parameter) + (type_identifier) @type (field_identifier) @property (identifier) @variable +(package_identifier) @variable + ; Operators @@ -79,10 +88,8 @@ "go" "goto" "if" - "import" "interface" "map" - "package" "range" "return" "select" @@ -92,6 +99,29 @@ "var" ] @keyword +[ + "import" + "package" +] @keyword.control.import + +; Delimiters + +[ + ":" + "." + "," + ";" +] @punctuation.delimiter + +[ + "(" + ")" + "[" + "]" + "{" + "}" +] @punctuation.bracket + ; Literals [ @@ -111,7 +141,8 @@ [ (true) (false) - (nil) -] @constant.builtin +] @constant.builtin.boolean + +(nil) @constant.builtin (comment) @comment diff --git a/runtime/queries/go/locals.scm b/runtime/queries/go/locals.scm new file mode 100644 index 00000000..d240e2b7 --- /dev/null +++ b/runtime/queries/go/locals.scm @@ -0,0 +1,30 @@ +; Scopes + +(block) @local.scope + +; Definitions + +(parameter_declaration (identifier) @local.definition) +(variadic_parameter_declaration (identifier) @local.definition) + +(short_var_declaration + left: (expression_list + (identifier) @local.definition)) + +(var_spec + name: (identifier) @local.definition) + +(for_statement + (range_clause + left: (expression_list + (identifier) @local.definition))) + +(const_declaration + (const_spec + name: (identifier) @local.definition)) + +; References + +(identifier) @local.reference +(field_identifier) @local.reference + diff --git a/runtime/queries/haskell/highlights.scm b/runtime/queries/haskell/highlights.scm index ecaa2d2c..dada80b6 100644 --- a/runtime/queries/haskell/highlights.scm +++ b/runtime/queries/haskell/highlights.scm @@ -2,19 +2,19 @@ (operator) @operator (exp_name (constructor) @constructor) (constructor_operator) @operator -(module) @module_name +(module) @namespace (type) @type (type) @class (constructor) @constructor (pragma) @pragma (comment) @comment (signature name: (variable) @fun_type_name) -(function name: (variable) @fun_name) +(function name: (variable) @function) (constraint class: (class_name (type)) @class) (class (class_head class: (class_name (type)) @class)) (instance (instance_head class: (class_name (type)) @class)) -(integer) @literal -(exp_literal (float)) @literal +(integer) @number +(exp_literal (float)) @number (char) @literal (con_unit) @literal (con_list) @literal @@ -39,5 +39,7 @@ "do" @keyword "mdo" @keyword "rec" @keyword -"(" @paren -")" @paren +[ + "(" + ")" +] @punctuation.bracket diff --git a/runtime/queries/javascript/highlights.scm b/runtime/queries/javascript/highlights.scm index a18c38d9..e29829bf 100644 --- a/runtime/queries/javascript/highlights.scm +++ b/runtime/queries/javascript/highlights.scm @@ -87,7 +87,7 @@ (template_string) ] @string -(regex) @string.special +(regex) @string.regexp (number) @number ; Tokens diff --git a/runtime/queries/julia/highlights.scm b/runtime/queries/julia/highlights.scm index a53dabe5..7b7d426c 100644 --- a/runtime/queries/julia/highlights.scm +++ b/runtime/queries/julia/highlights.scm @@ -1,9 +1,3 @@ -(identifier) @variable -;; In case you want type highlighting based on Julia naming conventions (this might collide with mathematical notation) -;((identifier) @type ; exception: mark `A_foo` sort of identifiers as variables - ;(match? @type "^[A-Z][^_]")) -((identifier) @constant - (match? @constant "^[A-Z][A-Z_]{2}[A-Z_]*$")) [ (triple_string) @@ -28,43 +22,43 @@ (call_expression (identifier) @function) (call_expression - (field_expression (identifier) @method .)) + (field_expression (identifier) @function.method .)) (broadcast_call_expression (identifier) @function) (broadcast_call_expression - (field_expression (identifier) @method .)) + (field_expression (identifier) @function.method .)) (parameter_list - (identifier) @parameter) + (identifier) @variable.parameter) (parameter_list (optional_parameter . - (identifier) @parameter)) + (identifier) @variable.parameter)) (typed_parameter - (identifier) @parameter + (identifier) @variable.parameter (identifier) @type) (type_parameter_list (identifier) @type) (typed_parameter - (identifier) @parameter + (identifier) @variable.parameter (parameterized_identifier) @type) (function_expression - . (identifier) @parameter) -(spread_parameter) @parameter + . (identifier) @variable.parameter) +(spread_parameter) @variable.parameter (spread_parameter - (identifier) @parameter) + (identifier) @variable.parameter) (named_argument - . (identifier) @parameter) + . (identifier) @variable.parameter) (argument_list (typed_expression - (identifier) @parameter + (identifier) @variable.parameter (identifier) @type)) (argument_list (typed_expression - (identifier) @parameter + (identifier) @variable.parameter (parameterized_identifier) @type)) ;; Symbol expressions (:my-wanna-be-lisp-keyword) (quote_expression - (identifier)) @symbol + (identifier)) @string.special.symbol ;; Parsing error! foo (::Type) get's parsed as two quote expressions (argument_list @@ -76,7 +70,7 @@ (identifier) @type) (parameterized_identifier (_)) @type (argument_list - (typed_expression . (identifier) @parameter)) + (typed_expression . (identifier) @variable.parameter)) (typed_expression (identifier) @type .) @@ -113,13 +107,13 @@ "end" @keyword (if_statement - ["if" "end"] @conditional) + ["if" "end"] @keyword.control.conditional) (elseif_clause - ["elseif"] @conditional) + ["elseif"] @keyword.control.conditional) (else_clause - ["else"] @conditional) + ["else"] @keyword.control.conditional) (ternary_expression - ["?" ":"] @conditional) + ["?" ":"] @keyword.control.conditional) (function_definition ["function" "end"] @keyword.function) @@ -134,47 +128,57 @@ "type" ] @keyword -((identifier) @keyword (#any-of? @keyword "global" "local")) +((identifier) @keyword (match? @keyword "global|local")) (compound_expression ["begin" "end"] @keyword) (try_statement - ["try" "end" ] @exception) + ["try" "end" ] @keyword.control.exception) (finally_clause - "finally" @exception) + "finally" @keyword.control.exception) (catch_clause - "catch" @exception) + "catch" @keyword.control.exception) (quote_statement ["quote" "end"] @keyword) (let_statement ["let" "end"] @keyword) (for_statement - ["for" "end"] @repeat) + ["for" "end"] @keyword.control.repeat) (while_statement - ["while" "end"] @repeat) -(break_statement) @repeat -(continue_statement) @repeat + ["while" "end"] @keyword.control.repeat) +(break_statement) @keyword.control.repeat +(continue_statement) @keyword.control.repeat (for_binding - "in" @repeat) + "in" @keyword.control.repeat) (for_clause - "for" @repeat) + "for" @keyword.control.repeat) (do_clause ["do" "end"] @keyword) (export_statement - ["export"] @include) + ["export"] @keyword.control.import) [ "using" "module" "import" -] @include +] @keyword.control.import -((identifier) @include (#eq? @include "baremodule")) +((identifier) @keyword.control.import (#eq? @keyword.control.import "baremodule")) (((identifier) @constant.builtin) (match? @constant.builtin "^(nothing|Inf|NaN)$")) -(((identifier) @boolean) (eq? @boolean "true")) -(((identifier) @boolean) (eq? @boolean "false")) +(((identifier) @constant.builtin.boolean) (#eq? @constant.builtin.boolean "true")) +(((identifier) @constant.builtin.boolean) (#eq? @constant.builtin.boolean "false")) + ["::" ":" "." "," "..." "!"] @punctuation.delimiter ["[" "]" "(" ")" "{" "}"] @punctuation.bracket + +["="] @operator + +(identifier) @variable +;; In case you want type highlighting based on Julia naming conventions (this might collide with mathematical notation) +;((identifier) @type ; exception: mark `A_foo` sort of identifiers as variables + ;(match? @type "^[A-Z][^_]")) +((identifier) @constant + (match? @constant "^[A-Z][A-Z_]{2}[A-Z_]*$")) diff --git a/runtime/queries/latex/highlights.scm b/runtime/queries/latex/highlights.scm index cd04a62c..f045c82d 100644 --- a/runtime/queries/latex/highlights.scm +++ b/runtime/queries/latex/highlights.scm @@ -259,7 +259,7 @@ (comment) @comment -(bracket_group) @parameter +(bracket_group) @variable.parameter [(math_operator) "="] @operator @@ -312,7 +312,7 @@ key: (word) @text.reference) (key_val_pair - key: (_) @parameter + key: (_) @variable.parameter value: (_)) ["[" "]" "{" "}"] @punctuation.bracket ;"(" ")" is has no special meaning in LaTeX diff --git a/runtime/queries/ledger/injections.scm b/runtime/queries/ledger/injections.scm index 4bb7d675..2d948141 100644 --- a/runtime/queries/ledger/injections.scm +++ b/runtime/queries/ledger/injections.scm @@ -1 +1,2 @@ (comment) @comment +(note) @comment diff --git a/runtime/queries/lua/highlights.scm b/runtime/queries/lua/highlights.scm index 8e27a39a..40c2be70 100644 --- a/runtime/queries/lua/highlights.scm +++ b/runtime/queries/lua/highlights.scm @@ -23,27 +23,27 @@ "for" "do" "end" -] @keyword.control.loop) +] @keyword.control.repeat) (for_in_statement [ "for" "do" "end" -] @keyword.control.loop) +] @keyword.control.repeat) (while_statement [ "while" "do" "end" -] @keyword.control.loop) +] @keyword.control.repeat) (repeat_statement [ "repeat" "until" -] @keyword.control.loop) +] @keyword.control.repeat) (do_statement [ @@ -65,7 +65,7 @@ "not" "and" "or" -] @keyword.operator +] @operator [ "=" @@ -108,7 +108,7 @@ [ (false) (true) -] @boolean +] @constant.builtin.boolean (nil) @constant.builtin (spread) @constant ;; "..." ((identifier) @constant @@ -116,7 +116,7 @@ ;; Parameters (parameters - (identifier) @parameter) + (identifier) @variable.parameter) ; ;; Functions (function [(function_name) (identifier)] @function) @@ -139,8 +139,8 @@ (function_call [ - ((identifier) @variable (method) @method) - ((_) (method) @method) + ((identifier) @variable (method) @function.method) + ((_) (method) @function.method) (identifier) @function (field_expression (property_identifier) @function) ] diff --git a/runtime/queries/ocaml/highlights.scm b/runtime/queries/ocaml/highlights.scm index 093b3cce..160f2cb4 100644 --- a/runtime/queries/ocaml/highlights.scm +++ b/runtime/queries/ocaml/highlights.scm @@ -25,12 +25,12 @@ (external (value_name) @function) -(method_name) @method +(method_name) @function.method ; Variables ;---------- -(value_pattern) @parameter +(value_pattern) @variable.parameter ; Application ;------------ @@ -60,7 +60,7 @@ [(number) (signed_number)] @number -(character) @character +(character) @constant.character (string) @string @@ -92,7 +92,7 @@ ["include" "open"] @include -["for" "to" "downto" "while" "do" "done"] @keyword.control.loop +["for" "to" "downto" "while" "do" "done"] @keyword.control.repeat ; Macros ;------- diff --git a/runtime/queries/ruby/highlights.scm b/runtime/queries/ruby/highlights.scm index 7f296f3b..8617d6f0 100644 --- a/runtime/queries/ruby/highlights.scm +++ b/runtime/queries/ruby/highlights.scm @@ -100,7 +100,7 @@ (bare_symbol) ] @string.special.symbol -(regex) @string.special.regex +(regex) @string.regexp (escape_sequence) @escape [ diff --git a/runtime/queries/rust/highlights.scm b/runtime/queries/rust/highlights.scm index 6b14d74d..956a5dac 100644 --- a/runtime/queries/rust/highlights.scm +++ b/runtime/queries/rust/highlights.scm @@ -17,7 +17,7 @@ (escape_sequence) @escape (primitive_type) @type.builtin -(boolean_literal) @constant.builtin +(boolean_literal) @constant.builtin.boolean [ (integer_literal) (float_literal) @@ -149,7 +149,7 @@ (mutable_specifier) @keyword.mut - +; TODO: variable.mut to highlight mutable identifiers via locals.scm ; ------- ; Guess Other Types diff --git a/runtime/queries/rust/locals.scm b/runtime/queries/rust/locals.scm new file mode 100644 index 00000000..6428f9b4 --- /dev/null +++ b/runtime/queries/rust/locals.scm @@ -0,0 +1,17 @@ +; Scopes + +(block) @local.scope + +; Definitions + +(parameter + (identifier) @local.definition) + +(let_declaration + pattern: (identifier) @local.definition) + +(closure_parameters (identifier)) @local.definition + +; References +(identifier) @local.reference + diff --git a/runtime/queries/svelte/highlights.scm b/runtime/queries/svelte/highlights.scm new file mode 100644 index 00000000..4c6f5f35 --- /dev/null +++ b/runtime/queries/svelte/highlights.scm @@ -0,0 +1,68 @@ +; Special identifiers +;-------------------- + +; TODO: +((element (start_tag (tag_name) @_tag) (text) @markup.heading) + (#match? @_tag "^(h[0-9]|title)$")) + +((element (start_tag (tag_name) @_tag) (text) @markup.bold) + (#match? @_tag "^(strong|b)$")) + +((element (start_tag (tag_name) @_tag) (text) @markup.italic) + (#match? @_tag "^(em|i)$")) + +; ((element (start_tag (tag_name) @_tag) (text) @markup.strike) +; (#match? @_tag "^(s|del)$")) + +((element (start_tag (tag_name) @_tag) (text) @markup.underline) + (#eq? @_tag "u")) + +((element (start_tag (tag_name) @_tag) (text) @markup.inline) + (#match? @_tag "^(code|kbd)$")) + +((element (start_tag (tag_name) @_tag) (text) @markup.underline.link) + (#eq? @_tag "a")) + +((attribute + (attribute_name) @_attr + (quoted_attribute_value (attribute_value) @markup.undeline.link)) + (#match? @_attr "^(href|src)$")) + +(tag_name) @tag +(attribute_name) @property +(erroneous_end_tag_name) @error +(comment) @comment + +[ + (attribute_value) + (quoted_attribute_value) +] @string + +[ + (text) + (raw_text_expr) +] @none + +[ + (special_block_keyword) + (then) + (as) +] @keyword + +[ + "{" + "}" +] @punctuation.brackets + +"=" @operator + +[ + "<" + ">" + "</" + "/>" + "#" + ":" + "/" + "@" +] @punctuation.definition.tag diff --git a/runtime/queries/svelte/indents.toml b/runtime/queries/svelte/indents.toml new file mode 100644 index 00000000..693db8e3 --- /dev/null +++ b/runtime/queries/svelte/indents.toml @@ -0,0 +1,18 @@ +indent = [ + "element" + "if_statement" + "each_statement" + "await_statement" +] + +outdent = [ + "end_tag" + "else_statement" + "if_end_expr" + "each_end_expr" + "await_end_expr" + ">" + "/>" +] + +ignore = "comment" diff --git a/runtime/queries/svelte/injections.scm b/runtime/queries/svelte/injections.scm new file mode 100644 index 00000000..266f4701 --- /dev/null +++ b/runtime/queries/svelte/injections.scm @@ -0,0 +1,30 @@ +; injections.scm +; -------------- +((style_element + (raw_text) @injection.content) + (#set! injection.language "css")) + +((attribute + (attribute_name) @_attr + (quoted_attribute_value (attribute_value) @css)) + (#eq? @_attr "style")) + +((script_element + (raw_text) @injection.content) + (#set! injection.language "javascript")) + +((raw_text_expr) @injection.content + (#set! injection.language "javascript")) + +( + (script_element + (start_tag + (attribute + (quoted_attribute_value (attribute_value) @_lang))) + (raw_text) @injection.content) + (#match? @_lang "(ts|typescript)") + (#set! injection.language "typescript") +) + +(comment) @comment + diff --git a/runtime/queries/tsx/highlights.scm b/runtime/queries/tsx/highlights.scm new file mode 100644 index 00000000..1b61e36d --- /dev/null +++ b/runtime/queries/tsx/highlights.scm @@ -0,0 +1 @@ +; inherits: typescript diff --git a/runtime/queries/yaml/highlights.scm b/runtime/queries/yaml/highlights.scm index 4ebb4440..2955a4ce 100644 --- a/runtime/queries/yaml/highlights.scm +++ b/runtime/queries/yaml/highlights.scm @@ -1,6 +1,6 @@ (block_mapping_pair key: (_) @property) (flow_mapping (_ key: (_) @property)) -(boolean_scalar) @boolean +(boolean_scalar) @constant.builtin.boolean (null_scalar) @constant.builtin (double_quote_scalar) @string (single_quote_scalar) @string diff --git a/runtime/themes/dark_plus.toml b/runtime/themes/dark_plus.toml index c105d52b..c48a7e28 100644 --- a/runtime/themes/dark_plus.toml +++ b/runtime/themes/dark_plus.toml @@ -34,6 +34,7 @@ "comment" = { fg = "#6A9955" } "string" = { fg = "#ce9178" } +"string.regexp" = { fg = "regex" } "number" = { fg = "#b5cea8" } "escape" = { fg = "#d7ba7d" } @@ -61,7 +62,7 @@ "ui.text.focus" = { fg = "#ffffff" } "warning" = { fg = "#cca700" } -"error" = { fg = "#f48771" } +"error" = { fg = "#ff1212" } "info" = { fg = "#75beff" } "hint" = { fg = "#eeeeeeb3" } diff --git a/runtime/themes/everforest_dark.toml b/runtime/themes/everforest_dark.toml new file mode 100644 index 00000000..462c8265 --- /dev/null +++ b/runtime/themes/everforest_dark.toml @@ -0,0 +1,87 @@ +# Everforest (Dark Hard) +# Author: CptPotato + +# Original Author: +# URL: https://github.com/sainnhe/everforest +# Filename: autoload/everforest.vim +# Author: sainnhe +# Email: sainnhe@gmail.com +# License: MIT License + +"escape" = "orange" +"type" = "yellow" +"constant" = "purple" +"number" = "purple" +"string" = "grey2" +"comment" = "grey0" +"variable" = "fg" +"variable.builtin" = "blue" +"variable.parameter" = "fg" +"variable.property" = "fg" +"label" = "aqua" +"punctuation" = "grey2" +"punctuation.delimiter" = "grey2" +"punctuation.bracket" = "fg" +"keyword" = "red" +"operator" = "orange" +"function" = "green" +"function.builtin" = "blue" +"function.macro" = "aqua" +"tag" = "yellow" +"namespace" = "aqua" +"attribute" = "aqua" +"constructor" = "yellow" +"module" = "blue" +"property" = "fg" +"special" = "orange" + +"ui.background" = { bg = "bg0" } +"ui.cursor" = { fg = "bg0", bg = "fg" } +"ui.cursor.match" = { fg = "orange", bg = "bg_yellow" } +"ui.cursor.insert" = { fg = "bg0", bg = "grey1" } +"ui.cursor.select" = { fg = "bg0", bg = "blue" } +"ui.linenr" = "grey0" +"ui.linenr.selected" = "fg" +"ui.statusline" = { fg = "grey2", bg = "bg2" } +"ui.statusline.inactive" = { fg = "grey0", bg = "bg1" } +"ui.popup" = { fg = "grey2", bg = "bg1" } +"ui.window" = { fg = "grey2", bg = "bg1" } +"ui.help" = { fg = "fg", bg = "bg1" } +"ui.text" = "fg" +"ui.text.focus" = "fg" +"ui.menu" = { fg = "fg", bg = "bg2" } +"ui.menu.selected" = { fg = "bg0", bg = "green" } +"ui.selection" = { bg = "bg3" } + +"hint" = "blue" +"info" = "aqua" +"warning" = "yellow" +"error" = "red" +"diagnostic" = { modifiers = ["underlined"] } + + +[palette] + +bg0 = "#2b3339" +bg1 = "#323c41" +bg2 = "#3a454a" +bg3 = "#445055" +bg4 = "#4c555b" +bg5 = "#53605c" +bg_visual = "#503946" +bg_red = "#4e3e43" +bg_green = "#404d44" +bg_blue = "#394f5a" +bg_yellow = "#4a4940" + +fg = "#d3c6aa" +red = "#e67e80" +orange = "#e69875" +yellow = "#dbbc7f" +green = "#a7c080" +aqua = "#83c092" +blue = "#7fbbb3" +purple = "#d699b6" +grey0 = "#7a8478" +grey1 = "#859289" +grey2 = "#9da9a0" diff --git a/runtime/themes/monokai.toml b/runtime/themes/monokai.toml index 2407591a..a8f03ff3 100644 --- a/runtime/themes/monokai.toml +++ b/runtime/themes/monokai.toml @@ -34,6 +34,7 @@ "comment" = { fg = "#88846F" } "string" = { fg = "#e6db74" } +"string.regexp" = { fg = "regex" } "number" = { fg = "#ae81ff" } "escape" = { fg = "#ae81ff" } |