rc zig: auto-insert multiline string prefix on newline
This commit is contained in:
parent
73910efce8
commit
bdd7a956f3
|
@ -102,8 +102,8 @@ define-command -hidden zig-trim-indent %{
|
||||||
|
|
||||||
define-command -hidden zig-insert-on-new-line %<
|
define-command -hidden zig-insert-on-new-line %<
|
||||||
evaluate-commands -draft -itersel %<
|
evaluate-commands -draft -itersel %<
|
||||||
# copy // or /// comments prefix and following whitespace
|
# copy // or /// comments prefix or \\ string literal prefix and following whitespace
|
||||||
try %< execute-keys -draft k <a-x> s ^\h*\K///?\h* <ret> y gh j P >
|
try %< execute-keys -draft k <a-x> s ^\h*\K(///?|\\\\)\h* <ret> y gh j P >
|
||||||
>
|
>
|
||||||
>
|
>
|
||||||
|
|
||||||
|
@ -112,8 +112,8 @@ define-command -hidden zig-indent-on-new-line %<
|
||||||
# preserve indent level
|
# preserve indent level
|
||||||
try %< execute-keys -draft <semicolon> K <a-&> >
|
try %< execute-keys -draft <semicolon> K <a-&> >
|
||||||
try %<
|
try %<
|
||||||
# only if we didn't copy a comment
|
# only if we didn't copy a comment or multiline string
|
||||||
execute-keys -draft <a-x> <a-K> ^\h*// <ret>
|
execute-keys -draft <a-x> <a-K> ^\h*(//|\\\\) <ret>
|
||||||
# indent after lines ending in {
|
# indent after lines ending in {
|
||||||
try %< execute-keys -draft k <a-x> <a-k> \{\h*$ <ret> j <a-gt> >
|
try %< execute-keys -draft k <a-x> <a-k> \{\h*$ <ret> j <a-gt> >
|
||||||
# deindent closing } when after cursor
|
# deindent closing } when after cursor
|
||||||
|
|
Loading…
Reference in New Issue
Block a user