From 0af8928d630ada730402ad182e8d36a5db06a142 Mon Sep 17 00:00:00 2001 From: Ray Gervais Date: Sat, 2 Oct 2021 21:13:53 -0400 Subject: adds: nord colortheme (#799) --- runtime/themes/nord.toml | 84 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 runtime/themes/nord.toml (limited to 'runtime') diff --git a/runtime/themes/nord.toml b/runtime/themes/nord.toml new file mode 100644 index 00000000..c6a0e172 --- /dev/null +++ b/runtime/themes/nord.toml @@ -0,0 +1,84 @@ +# Author : RayGervais + +# "ui.linenr.selected" = { fg = "#d8dee9" } +# "ui.text.focus" = { fg = "#e5ded6", modifiers= ["bold"] } +# "ui.menu.selected" = { fg = "#e5ded6", bg = "#313f4e" } + +# "info" = "#b48ead" +# "hint" = "#a3be8c" + +# Polar Night +# nord0 - background color +"ui.background" = { bg = "#2e3440" } +"ui.statusline.inactive" = { fg = "#d8dEE9", bg = "#2e3440" } + + +# nord1 - status bars, panels, modals, autocompletion +"ui.statusline" = { fg = "#88c0d0", bg = "#3b4252" } +"ui.popup" = { bg = "#232d38" } +"ui.window" = { bg = "#232d38" } +"ui.help" = { bg = "#232d38", fg = "#e5ded6" } + +# nord2 - active line, highlighting +"ui.selection" = { bg = "#434c5e" } +"ui.cursor.match" = { bg = "434c5e" } + +# nord3 - comments +"comment" = "#4c566a" +"ui.linenr" = { fg = "#4c566a" } + +# Snow Storm +# nord4 - cursor, variables, constants, attributes, fields +"ui.cursor.primary" = { fg = "#d8dee9", modifiers = ["reversed"] } +"attribute" = "#d8dee9" +"variable" = "#d8dee9" +"constant" = "#d8dee9" +"variable.builtin" = "#d8dee9" +"constant.builtin" = "#d8dee9" +"namespace" = "#d8dee9" + +# nord5 - suble UI text + +# nord6 - base text, punctuation +"ui.text" = { fg = "#eceff4" } +"punctuation" = "#eceff4" + +# Frost +# nord7 - classes, types, primiatives +"type" = "#8fbcbb" +"type.builtin" = { fg = "#8fbcbb"} +"label" = "#8fbcbb" + +# nord8 - declaration, methods, routines +"constructor" = "#88c0d0" +"function" = "#88c0d0" +"function.macro" = { fg = "#88c0d0" } +"function.builtin" = { fg = "#88c0d0" } + +# nord9 - operator, tags, units, punctuations +"punctuation.delimiter" = "#81a1c1" +"operator" = { fg = "#81a1c1" } +"property" = "#81a1c1" + +# nord10 - keywords, special +"keyword" = { fg = "#5e81ac" } +"keyword.directive" = "#5e81ac" +"variable.parameter" = "#5e81ac" + +# Aurora +# nord11 - error +"error" = "#bf616a" + +# nord12 - annotations, decorators +"special" = "#d08770" +"module" = "#d08770" + +# nord13 - warnings, escape characters, regex +"warning" = "#ebcb8b" +"escape" = { fg = "#ebcb8b" } + +# nord14 - strings +"string" = "#a3be8c" + +# nord15 - integer, floating point +"number" = "#b48ead" -- cgit v1.2.3-70-g09d2 From 0e06c10d8cb45f698bacc7b212b8c5d1ab200700 Mon Sep 17 00:00:00 2001 From: voroskoi Date: Tue, 5 Oct 2021 05:18:15 +0200 Subject: Zig tree-sitter rework (#811) - update tree-sitter-zig subproject - use highlights.scm from upstream, just use helix scopes - update indents.toml, this one actually works--- helix-syntax/languages/tree-sitter-zig | 2 +- runtime/queries/zig/highlights.scm | 197 ++++++++++++++++++++------------- runtime/queries/zig/indents.toml | 9 +- 3 files changed, 123 insertions(+), 85 deletions(-) (limited to 'runtime') diff --git a/helix-syntax/languages/tree-sitter-zig b/helix-syntax/languages/tree-sitter-zig index 049162be..1f27fd1d 160000 --- a/helix-syntax/languages/tree-sitter-zig +++ b/helix-syntax/languages/tree-sitter-zig @@ -1 +1 @@ -Subproject commit 049162bea8a44e1a4acd01b06e1c8672d9231a86 +Subproject commit 1f27fd1dfe7f352408f01b4894c7825f3a1d6c47 diff --git a/runtime/queries/zig/highlights.scm b/runtime/queries/zig/highlights.scm index 5a3d62dc..404a8682 100644 --- a/runtime/queries/zig/highlights.scm +++ b/runtime/queries/zig/highlights.scm @@ -4,82 +4,89 @@ (line_comment) ] @comment -; field in top level decl, and in struct, union... -(ContainerField - (IDENTIFIER) @property - (SuffixExpr (IDENTIFIER) @type)? -) +[ + variable: (IDENTIFIER) + variable_type_function: (IDENTIFIER) +] @variable -; error.OutOfMemory; -(SuffixExpr - "error" - "." - (IDENTIFIER) @constant +parameter: (IDENTIFIER) @variable.parameter + +[ + field_member: (IDENTIFIER) + field_access: (IDENTIFIER) +] @variable.property + +;; assume TitleCase is a type +( + [ + variable_type_function: (IDENTIFIER) + field_access: (IDENTIFIER) + parameter: (IDENTIFIER) + ] @type + (#match? @type "^[A-Z]([a-z]+[A-Za-z0-9]*)*$") +) +;; assume camelCase is a function +( + [ + variable_type_function: (IDENTIFIER) + field_access: (IDENTIFIER) + parameter: (IDENTIFIER) + ] @function + (#match? @function "^[a-z]+([A-Z][a-z0-9]*)+$") ) -; var x: IDENTIFIER -type: (SuffixExpr (IDENTIFIER) @type) +;; assume all CAPS_1 is a constant +( + [ + variable_type_function: (IDENTIFIER) + field_access: (IDENTIFIER) + ] @constant + (#match? @constant "^[A-Z][A-Z_0-9]+$") +) -; IDENTIFIER{} -constructor: (SuffixExpr (IDENTIFIER) @constructor) +[ + function_call: (IDENTIFIER) + function: (IDENTIFIER) +] @function -; fields -(FieldInit (IDENTIFIER) @property) +exception: "!" @function.macro -; foo.bar.baz.function() calls ( - (SuffixOp - (IDENTIFIER) @function - ) - . - (FnCallArguments) + (IDENTIFIER) @variable.builtin + (#eq? @variable.builtin "_") ) -; function() calls +(PtrTypeStart "c" @variable.builtin) + ( - ( - (IDENTIFIER) @function + (ContainerDeclType + [ + (ErrorUnionExpr) + "enum" + ] ) - . - (FnCallArguments) + (ContainerField (IDENTIFIER) @constant) ) -; functionn decl -(FnProto - (IDENTIFIER) @function - (SuffixExpr (IDENTIFIER) @type)? - ("!")? @function.macro -) +field_constant: (IDENTIFIER) @constant -; function parameters and types -(ParamDecl - (IDENTIFIER) @variable.parameter - ":" - [ - (ParamType (SuffixExpr (IDENTIFIER) @type)) - (ParamType) - ] -) +(BUILTINIDENTIFIER) @function.builtin -; switch -(SwitchItem - (SuffixExpr - "." - . - (IDENTIFIER) @constant - ) -) +((BUILTINIDENTIFIER) @keyword.control.import + (#any-of? @keyword.control.import "@import" "@cImport")) (INTEGER) @number (FLOAT) @number [ - (STRINGLITERAL) + (LINESTRING) (STRINGLITERALSINGLE) ] @string -(CHAR_LITERAL) @string +(CHAR_LITERAL) @constant.character +(EscapeSequence) @escape +(FormatSequence) @string.special [ "allowzero" @@ -95,6 +102,9 @@ constructor: (SuffixExpr (IDENTIFIER) @constructor) [ "true" "false" +] @constant.builtin.boolean + +[ "undefined" "unreachable" "null" @@ -104,21 +114,18 @@ constructor: (SuffixExpr (IDENTIFIER) @constructor) "else" "if" "switch" +] @keyword.control.conditional + +[ "for" "while" - "return" - "break" - "continue" - "defer" - "errdefer" - "async" - "nosuspend" - "await" - "suspend" - "resume" - "try" - "catch" -] @keyword.control +] @keyword.control.repeat + +[ + "or" + "and" + "orelse" +] @operator [ "struct" @@ -127,21 +134,48 @@ constructor: (SuffixExpr (IDENTIFIER) @constructor) "error" "packed" "opaque" - "test" - "usingnamespace" - "export" - "extern" - "const" - "var" - "comptime" - "threadlocal" ] @keyword [ - "pub" + "try" + "error" + "catch" +] @function.macro + +; VarDecl +[ + "comptime" + "threadlocal" "fn" ] @keyword.function +[ + "const" + "var" + "test" + "pub" + "usingnamespace" +] @keyword + +[ + "return" + "break" + "continue" +] @keyword.control + +; Macro +[ + "defer" + "errdefer" + "async" + "nosuspend" + "await" + "suspend" + "resume" + "export" + "extern" +] @function.macro + ; PrecProc [ "inline" @@ -149,10 +183,9 @@ constructor: (SuffixExpr (IDENTIFIER) @constructor) "asm" "callconv" "noalias" -] @attribute +] @keyword.directive [ - (BUILTINIDENTIFIER) "linksection" "align" ] @function.builtin @@ -164,9 +197,6 @@ constructor: (SuffixExpr (IDENTIFIER) @constructor) (AdditionOp) (MultiplyOp) (PrefixOp) - "or" - "and" - "orelse" "*" "**" "->" @@ -174,6 +204,7 @@ constructor: (SuffixExpr (IDENTIFIER) @constructor) ".?" ".*" "=" + "?" ] @operator [ @@ -186,6 +217,9 @@ constructor: (SuffixExpr (IDENTIFIER) @constructor) [ ".." "..." +] @punctuation.special + +[ "[" "]" "(" @@ -195,4 +229,7 @@ constructor: (SuffixExpr (IDENTIFIER) @constructor) (Payload "|") (PtrPayload "|") (PtrIndexPayload "|") -] @punctuation +] @punctuation.bracket + +; Error +(ERROR) @keyword diff --git a/runtime/queries/zig/indents.toml b/runtime/queries/zig/indents.toml index e119078b..88f88e16 100644 --- a/runtime/queries/zig/indents.toml +++ b/runtime/queries/zig/indents.toml @@ -1,8 +1,9 @@ indent = [ - "block", - "match_block", - "arguments", - "parameters" + "Block", + "BlockExpr", + "ContainerDecl", + "SwitchExpr", + "InitList" ] outdent = [ -- cgit v1.2.3-70-g09d2