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] 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