From 73910efce80faad98c7e6252a1dfb310248b1088 Mon Sep 17 00:00:00 2001 From: c piapiac <_c@piapiac.org> Date: Sat, 12 Jun 2021 03:26:32 -0700 Subject: [PATCH 2/3] rc zig: 0.8.0 language changes * adds nosuspend keyword * adds @extern builtin * removes @TagType builtin --- rc/filetype/zig.kak | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rc/filetype/zig.kak b/rc/filetype/zig.kak index 956581c4..0e281b84 100644 --- a/rc/filetype/zig.kak +++ b/rc/filetype/zig.kak @@ -57,7 +57,7 @@ add-highlighter shared/zig/code/ regex '\b(?:const|var|extern|packed|export|pub| add-highlighter shared/zig/code/ regex '\b(?:struct|enum|union|error|opaque)\b' 0:attribute # statement -add-highlighter shared/zig/code/ regex '\b(?:break|return|continue|asm|defer|errdefer|unreachable|try|catch|async|noasync|await|suspend|resume)\b' 0:keyword +add-highlighter shared/zig/code/ regex '\b(?:break|return|continue|asm|defer|errdefer|unreachable|try|catch|async|noasync|await|suspend|nosuspend|resume)\b' 0:keyword # conditional add-highlighter shared/zig/code/ regex '\b(?:if|else|switch|and|or|orelse)\b' 0:keyword # repeat @@ -90,7 +90,7 @@ add-highlighter shared/zig/code/ regex '\b0x[0-9a-fA-F]+\.?[eE][-+]?[0-9a-fA-F]+ add-highlighter shared/zig/code/ regex '(?:\+|-|\*|/|%|=|<|>|&|\||\^|~|\?|!)' 0:operator # builtin functions -add-highlighter shared/zig/code/ regex "@(?:addWithOverflow|alignCast|alignOf|as|asyncCall|atomicLoad|atomicRmw|atomicStore|bitCast|bitOffsetOf|boolToInt|bitSizeOf|breakpoint|mulAdd|byteSwap|bitReverse|byteOffsetOf|call|cDefine|cImport|cInclude|clz|cmpxchgStrong|cmpxchgWeak|compileError|compileLog|ctz|cUndef|divExact|divFloor|divTrunc|embedFile|enumToInt|errorName|errorReturnTrace|errorToInt|errSetCast|export|fence|field|fieldParentPtr|floatCast|floatToInt|frame|Frame|frameAddress|frameSize|hasDecl|hasField|import|intCast|intToEnum|intToError|intToFloat|intToPtr|memcpy|memset|wasmMemorySize|wasmMemoryGrow|mod|mulWithOverflow|panic|popCount|ptrCast|ptrToInt|rem|returnAddress|setAlignStack|setCold|setEvalBranchQuota|setFloatMode|setRuntimeSafety|shlExact|shlWithOverflow|shrExact|shuffle|sizeOf|splat|reduce|src|sqrt|sin|cos|exp|exp2|log|log2|log10|fabs|floor|ceil|trunc|round|subWithOverflow|tagName|TagType|This|truncate|Type|typeInfo|typeName|TypeOf|unionInit)\b" 0:function +add-highlighter shared/zig/code/ regex "@(?:addWithOverflow|alignCast|alignOf|as|asyncCall|atomicLoad|atomicRmw|atomicStore|bitCast|bitOffsetOf|boolToInt|bitSizeOf|breakpoint|mulAdd|byteSwap|bitReverse|byteOffsetOf|call|cDefine|cImport|cInclude|clz|cmpxchgStrong|cmpxchgWeak|compileError|compileLog|ctz|cUndef|divExact|divFloor|divTrunc|embedFile|enumToInt|errorName|errorReturnTrace|errorToInt|errSetCast|export|extern|fence|field|fieldParentPtr|floatCast|floatToInt|frame|Frame|frameAddress|frameSize|hasDecl|hasField|import|intCast|intToEnum|intToError|intToFloat|intToPtr|memcpy|memset|wasmMemorySize|wasmMemoryGrow|mod|mulWithOverflow|panic|popCount|ptrCast|ptrToInt|rem|returnAddress|setAlignStack|setCold|setEvalBranchQuota|setFloatMode|setRuntimeSafety|shlExact|shlWithOverflow|shrExact|shuffle|sizeOf|splat|reduce|src|sqrt|sin|cos|exp|exp2|log|log2|log10|fabs|floor|ceil|trunc|round|subWithOverflow|tagName|This|truncate|Type|typeInfo|typeName|TypeOf|unionInit)\b" 0:function # Commands # ‾‾‾‾‾‾‾‾ From bdd7a956f38690996675b0e4d18d5e7e800dacb6 Mon Sep 17 00:00:00 2001 From: c piapiac <_c@piapiac.org> Date: Sat, 12 Jun 2021 03:38:27 -0700 Subject: [PATCH 3/3] rc zig: auto-insert multiline string prefix on newline --- rc/filetype/zig.kak | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rc/filetype/zig.kak b/rc/filetype/zig.kak index 0e281b84..86be366d 100644 --- a/rc/filetype/zig.kak +++ b/rc/filetype/zig.kak @@ -102,8 +102,8 @@ define-command -hidden zig-trim-indent %{ define-command -hidden zig-insert-on-new-line %< evaluate-commands -draft -itersel %< - # copy // or /// comments prefix and following whitespace - try %< execute-keys -draft k s ^\h*\K///?\h* y gh j P > + # copy // or /// comments prefix or \\ string literal prefix and following whitespace + try %< execute-keys -draft k s ^\h*\K(///?|\\\\)\h* y gh j P > > > @@ -112,8 +112,8 @@ define-command -hidden zig-indent-on-new-line %< # preserve indent level try %< execute-keys -draft K > try %< - # only if we didn't copy a comment - execute-keys -draft ^\h*// + # only if we didn't copy a comment or multiline string + execute-keys -draft ^\h*(//|\\\\) # indent after lines ending in { try %< execute-keys -draft k \{\h*$ j > # deindent closing } when after cursor