From 4b35a701c4e10e45c182eae9e1bf5868cd34ad8f Mon Sep 17 00:00:00 2001 From: John Isom Date: Sun, 26 Jul 2020 18:56:53 -0600 Subject: [PATCH 02/87] Fix indentation rule for c-family.kak --- rc/filetype/c-family.kak | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rc/filetype/c-family.kak b/rc/filetype/c-family.kak index 837c5059..4d9eca73 100644 --- a/rc/filetype/c-family.kak +++ b/rc/filetype/c-family.kak @@ -83,7 +83,7 @@ define-command -hidden c-family-indent-on-newline %< evaluate-commands -draft -i # remove previous empty lines resulting from the automatic indent try %< execute-keys -draft k ^\h+$ Hd > # indent after an opening brace or parenthesis at end of line - try %< execute-keys -draft k s[{(]\h*$ j > + try %< execute-keys -draft k [{(]\h*$ j > # indent after a label try %< execute-keys -draft k s[a-zA-Z0-9_-]+:\h*$ j > # indent after a statement not followed by an opening brace @@ -98,6 +98,8 @@ define-command -hidden c-family-indent-on-newline %< evaluate-commands -draft -i try %< execute-keys -draft K \;\h*(//[^\n]+)?$ \ K s \belse\b\h*(?://[^\n]+)?\n([^\n]*\n){2}\z \ 1 > + # deindent closing brace(s) + try %< execute-keys -draft ^\h*[})]+\h*$ > # align to the opening parenthesis or opening brace (whichever is first) # on a previous line if its followed by text on the same line try %< evaluate-commands -draft %< From 46ea52a0a81a1f4bd1e89df9e5d68be9d08acafa Mon Sep 17 00:00:00 2001 From: John Isom Date: Sun, 26 Jul 2020 12:21:07 -0600 Subject: [PATCH 03/87] Add test cases for c-family closing brace indentation --- .../deindent-function-closing-brace/cmd | 1 + .../deindent-function-closing-brace/in | 12 +++++++ .../deindent-function-closing-brace/out | 17 +++++++++ .../deindent-function-closing-brace/rc | 3 ++ .../deindent-generic-closing-brace/cmd | 1 + .../deindent-generic-closing-brace/in | 25 +++++++++++++ .../deindent-generic-closing-brace/out | 35 +++++++++++++++++++ .../deindent-generic-closing-brace/rc | 3 ++ .../c-family/deindent-if-closing-brace/cmd | 1 + .../c-family/deindent-if-closing-brace/in | 12 +++++++ .../c-family/deindent-if-closing-brace/out | 17 +++++++++ .../c-family/deindent-if-closing-brace/rc | 3 ++ 12 files changed, 130 insertions(+) create mode 100644 test/indent/c-family/deindent-function-closing-brace/cmd create mode 100644 test/indent/c-family/deindent-function-closing-brace/in create mode 100644 test/indent/c-family/deindent-function-closing-brace/out create mode 100644 test/indent/c-family/deindent-function-closing-brace/rc create mode 100644 test/indent/c-family/deindent-generic-closing-brace/cmd create mode 100644 test/indent/c-family/deindent-generic-closing-brace/in create mode 100644 test/indent/c-family/deindent-generic-closing-brace/out create mode 100644 test/indent/c-family/deindent-generic-closing-brace/rc create mode 100644 test/indent/c-family/deindent-if-closing-brace/cmd create mode 100644 test/indent/c-family/deindent-if-closing-brace/in create mode 100644 test/indent/c-family/deindent-if-closing-brace/out create mode 100644 test/indent/c-family/deindent-if-closing-brace/rc diff --git a/test/indent/c-family/deindent-function-closing-brace/cmd b/test/indent/c-family/deindent-function-closing-brace/cmd new file mode 100644 index 00000000..e3036a40 --- /dev/null +++ b/test/indent/c-family/deindent-function-closing-brace/cmd @@ -0,0 +1 @@ +c diff --git a/test/indent/c-family/deindent-function-closing-brace/in b/test/indent/c-family/deindent-function-closing-brace/in new file mode 100644 index 00000000..34193ba9 --- /dev/null +++ b/test/indent/c-family/deindent-function-closing-brace/in @@ -0,0 +1,12 @@ +void foo(void) {%( )} + +void foo(void) {%( ) +} + +void foo(void) {%( )bar()} + +void foo(void) {%( )bar() +} + +void foo(void) { + bar()%( )} diff --git a/test/indent/c-family/deindent-function-closing-brace/out b/test/indent/c-family/deindent-function-closing-brace/out new file mode 100644 index 00000000..827927d0 --- /dev/null +++ b/test/indent/c-family/deindent-function-closing-brace/out @@ -0,0 +1,17 @@ +void foo(void) { +} + +void foo(void) { + +} + +void foo(void) { + bar()} + +void foo(void) { + bar() +} + +void foo(void) { + bar() +} diff --git a/test/indent/c-family/deindent-function-closing-brace/rc b/test/indent/c-family/deindent-function-closing-brace/rc new file mode 100644 index 00000000..2c2a7247 --- /dev/null +++ b/test/indent/c-family/deindent-function-closing-brace/rc @@ -0,0 +1,3 @@ +source "%val{runtime}/colors/default.kak" +source "%val{runtime}/rc/filetype/c-family.kak" +set buffer filetype cpp diff --git a/test/indent/c-family/deindent-generic-closing-brace/cmd b/test/indent/c-family/deindent-generic-closing-brace/cmd new file mode 100644 index 00000000..e3036a40 --- /dev/null +++ b/test/indent/c-family/deindent-generic-closing-brace/cmd @@ -0,0 +1 @@ +c diff --git a/test/indent/c-family/deindent-generic-closing-brace/in b/test/indent/c-family/deindent-generic-closing-brace/in new file mode 100644 index 00000000..b2f7c26d --- /dev/null +++ b/test/indent/c-family/deindent-generic-closing-brace/in @@ -0,0 +1,25 @@ +{%( )} + +{%( ) +} + +{%( )bar()} + +{%( )bar() +} + +{ + bar()%( )} + +{(%( ))} + +{(%( ) +)} + +{(%( )foo())} + +{(%( )foo() +)} + +{( + bar()%( ))} diff --git a/test/indent/c-family/deindent-generic-closing-brace/out b/test/indent/c-family/deindent-generic-closing-brace/out new file mode 100644 index 00000000..58109817 --- /dev/null +++ b/test/indent/c-family/deindent-generic-closing-brace/out @@ -0,0 +1,35 @@ +{ +} + +{ + +} + +{ + bar()} + +{ + bar() +} + +{ + bar() +} + +{( +)} + +{( + +)} + +{( + foo())} + +{( + foo() +)} + +{( + bar() +)} diff --git a/test/indent/c-family/deindent-generic-closing-brace/rc b/test/indent/c-family/deindent-generic-closing-brace/rc new file mode 100644 index 00000000..2c2a7247 --- /dev/null +++ b/test/indent/c-family/deindent-generic-closing-brace/rc @@ -0,0 +1,3 @@ +source "%val{runtime}/colors/default.kak" +source "%val{runtime}/rc/filetype/c-family.kak" +set buffer filetype cpp diff --git a/test/indent/c-family/deindent-if-closing-brace/cmd b/test/indent/c-family/deindent-if-closing-brace/cmd new file mode 100644 index 00000000..e3036a40 --- /dev/null +++ b/test/indent/c-family/deindent-if-closing-brace/cmd @@ -0,0 +1 @@ +c diff --git a/test/indent/c-family/deindent-if-closing-brace/in b/test/indent/c-family/deindent-if-closing-brace/in new file mode 100644 index 00000000..8d46bc97 --- /dev/null +++ b/test/indent/c-family/deindent-if-closing-brace/in @@ -0,0 +1,12 @@ +if (1) {%( )} + +if (1) {%( ) +} + +if (1) {%( )bar()} + +if (1) {%( )bar() +} + +if (1) { + bar()%( )} diff --git a/test/indent/c-family/deindent-if-closing-brace/out b/test/indent/c-family/deindent-if-closing-brace/out new file mode 100644 index 00000000..df0b059e --- /dev/null +++ b/test/indent/c-family/deindent-if-closing-brace/out @@ -0,0 +1,17 @@ +if (1) { +} + +if (1) { + +} + +if (1) { + bar()} + +if (1) { + bar() +} + +if (1) { + bar() +} diff --git a/test/indent/c-family/deindent-if-closing-brace/rc b/test/indent/c-family/deindent-if-closing-brace/rc new file mode 100644 index 00000000..2c2a7247 --- /dev/null +++ b/test/indent/c-family/deindent-if-closing-brace/rc @@ -0,0 +1,3 @@ +source "%val{runtime}/colors/default.kak" +source "%val{runtime}/rc/filetype/c-family.kak" +set buffer filetype cpp From d2437b468d600c68f9c7736454888d2045eb16dd Mon Sep 17 00:00:00 2001 From: John Isom Date: Sun, 26 Jul 2020 20:01:50 -0600 Subject: [PATCH 04/87] Add test cases for rust closing brace indentation --- .../rust/deindent-function-closing-brace/cmd | 1 + .../rust/deindent-function-closing-brace/in | 12 +++++++ .../rust/deindent-function-closing-brace/out | 17 +++++++++ .../rust/deindent-function-closing-brace/rc | 3 ++ .../rust/deindent-generic-closing-brace/cmd | 1 + .../rust/deindent-generic-closing-brace/in | 25 +++++++++++++ .../rust/deindent-generic-closing-brace/out | 35 +++++++++++++++++++ .../rust/deindent-generic-closing-brace/rc | 3 ++ .../indent/rust/deindent-if-closing-brace/cmd | 1 + test/indent/rust/deindent-if-closing-brace/in | 12 +++++++ .../indent/rust/deindent-if-closing-brace/out | 17 +++++++++ test/indent/rust/deindent-if-closing-brace/rc | 3 ++ 12 files changed, 130 insertions(+) create mode 100644 test/indent/rust/deindent-function-closing-brace/cmd create mode 100644 test/indent/rust/deindent-function-closing-brace/in create mode 100644 test/indent/rust/deindent-function-closing-brace/out create mode 100644 test/indent/rust/deindent-function-closing-brace/rc create mode 100644 test/indent/rust/deindent-generic-closing-brace/cmd create mode 100644 test/indent/rust/deindent-generic-closing-brace/in create mode 100644 test/indent/rust/deindent-generic-closing-brace/out create mode 100644 test/indent/rust/deindent-generic-closing-brace/rc create mode 100644 test/indent/rust/deindent-if-closing-brace/cmd create mode 100644 test/indent/rust/deindent-if-closing-brace/in create mode 100644 test/indent/rust/deindent-if-closing-brace/out create mode 100644 test/indent/rust/deindent-if-closing-brace/rc diff --git a/test/indent/rust/deindent-function-closing-brace/cmd b/test/indent/rust/deindent-function-closing-brace/cmd new file mode 100644 index 00000000..e3036a40 --- /dev/null +++ b/test/indent/rust/deindent-function-closing-brace/cmd @@ -0,0 +1 @@ +c diff --git a/test/indent/rust/deindent-function-closing-brace/in b/test/indent/rust/deindent-function-closing-brace/in new file mode 100644 index 00000000..63c8bb53 --- /dev/null +++ b/test/indent/rust/deindent-function-closing-brace/in @@ -0,0 +1,12 @@ +fn foo() -> i32 {%( )} + +fn foo() -> i32 {%( ) +} + +fn foo() -> i32 {%( )bar()} + +fn foo() -> i32 {%( )bar() +} + +fn foo() -> i32 { + bar()%( )} diff --git a/test/indent/rust/deindent-function-closing-brace/out b/test/indent/rust/deindent-function-closing-brace/out new file mode 100644 index 00000000..1a887315 --- /dev/null +++ b/test/indent/rust/deindent-function-closing-brace/out @@ -0,0 +1,17 @@ +fn foo() -> i32 { +} + +fn foo() -> i32 { + +} + +fn foo() -> i32 { + bar()} + +fn foo() -> i32 { + bar() +} + +fn foo() -> i32 { + bar() +} diff --git a/test/indent/rust/deindent-function-closing-brace/rc b/test/indent/rust/deindent-function-closing-brace/rc new file mode 100644 index 00000000..64064c25 --- /dev/null +++ b/test/indent/rust/deindent-function-closing-brace/rc @@ -0,0 +1,3 @@ +source "%val{runtime}/colors/default.kak" +source "%val{runtime}/rc/filetype/rust.kak" +set buffer filetype rust diff --git a/test/indent/rust/deindent-generic-closing-brace/cmd b/test/indent/rust/deindent-generic-closing-brace/cmd new file mode 100644 index 00000000..e3036a40 --- /dev/null +++ b/test/indent/rust/deindent-generic-closing-brace/cmd @@ -0,0 +1 @@ +c diff --git a/test/indent/rust/deindent-generic-closing-brace/in b/test/indent/rust/deindent-generic-closing-brace/in new file mode 100644 index 00000000..b2f7c26d --- /dev/null +++ b/test/indent/rust/deindent-generic-closing-brace/in @@ -0,0 +1,25 @@ +{%( )} + +{%( ) +} + +{%( )bar()} + +{%( )bar() +} + +{ + bar()%( )} + +{(%( ))} + +{(%( ) +)} + +{(%( )foo())} + +{(%( )foo() +)} + +{( + bar()%( ))} diff --git a/test/indent/rust/deindent-generic-closing-brace/out b/test/indent/rust/deindent-generic-closing-brace/out new file mode 100644 index 00000000..58109817 --- /dev/null +++ b/test/indent/rust/deindent-generic-closing-brace/out @@ -0,0 +1,35 @@ +{ +} + +{ + +} + +{ + bar()} + +{ + bar() +} + +{ + bar() +} + +{( +)} + +{( + +)} + +{( + foo())} + +{( + foo() +)} + +{( + bar() +)} diff --git a/test/indent/rust/deindent-generic-closing-brace/rc b/test/indent/rust/deindent-generic-closing-brace/rc new file mode 100644 index 00000000..64064c25 --- /dev/null +++ b/test/indent/rust/deindent-generic-closing-brace/rc @@ -0,0 +1,3 @@ +source "%val{runtime}/colors/default.kak" +source "%val{runtime}/rc/filetype/rust.kak" +set buffer filetype rust diff --git a/test/indent/rust/deindent-if-closing-brace/cmd b/test/indent/rust/deindent-if-closing-brace/cmd new file mode 100644 index 00000000..e3036a40 --- /dev/null +++ b/test/indent/rust/deindent-if-closing-brace/cmd @@ -0,0 +1 @@ +c diff --git a/test/indent/rust/deindent-if-closing-brace/in b/test/indent/rust/deindent-if-closing-brace/in new file mode 100644 index 00000000..d5f59de0 --- /dev/null +++ b/test/indent/rust/deindent-if-closing-brace/in @@ -0,0 +1,12 @@ +if true {%( )} + +if true {%( ) +} + +if true {%( )bar()} + +if true {%( )bar() +} + +if true { + bar()%( )} diff --git a/test/indent/rust/deindent-if-closing-brace/out b/test/indent/rust/deindent-if-closing-brace/out new file mode 100644 index 00000000..2c63bd1c --- /dev/null +++ b/test/indent/rust/deindent-if-closing-brace/out @@ -0,0 +1,17 @@ +if true { +} + +if true { + +} + +if true { + bar()} + +if true { + bar() +} + +if true { + bar() +} diff --git a/test/indent/rust/deindent-if-closing-brace/rc b/test/indent/rust/deindent-if-closing-brace/rc new file mode 100644 index 00000000..64064c25 --- /dev/null +++ b/test/indent/rust/deindent-if-closing-brace/rc @@ -0,0 +1,3 @@ +source "%val{runtime}/colors/default.kak" +source "%val{runtime}/rc/filetype/rust.kak" +set buffer filetype rust From 194cb17aaec2f3bdd68d2e0a2525249309a39038 Mon Sep 17 00:00:00 2001 From: John Isom Date: Sun, 26 Jul 2020 20:04:18 -0600 Subject: [PATCH 05/87] Fix indentation rule for rust.kak --- rc/filetype/rust.kak | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rc/filetype/rust.kak b/rc/filetype/rust.kak index 24d36f88..55fd2c2b 100644 --- a/rc/filetype/rust.kak +++ b/rc/filetype/rust.kak @@ -112,6 +112,8 @@ define-command -hidden rust-indent-on-new-line %~ try %+ execute-keys -draft k ^\h*where\h*$ j + # dedent after lines starting with . and ending with , or ; try %_ execute-keys -draft k ^\h*\..*[,]\h*$ j _ + # deindent closing brace(s) + try %< execute-keys -draft ^\h*[})]+\h*$ > # todo dedent additional unmatched parenthesis # try %& execute-keys -draft k s \((?:[^)(]+|\((?:[^)(]+|\([^)(]*\))*\))*\) l Gl s\) %sh{ # count previous selections length From 902f2831d883221149c9e3c723d797497d476195 Mon Sep 17 00:00:00 2001 From: John Isom Date: Sun, 26 Jul 2020 20:28:14 -0600 Subject: [PATCH 06/87] Fix indentation rule for go.kak --- rc/filetype/go.kak | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rc/filetype/go.kak b/rc/filetype/go.kak index 69ce6c27..fa81bbed 100644 --- a/rc/filetype/go.kak +++ b/rc/filetype/go.kak @@ -89,6 +89,8 @@ define-command -hidden go-indent-on-new-line %~ try %[ execute-keys -draft k ^\h*(case|default).*:$ j ] # indent after if|else|while|for try %[ execute-keys -draft )MB \A(if|else|while|for)\h*\(.*\)\h*\n\h*\n?\z s \A|.\z 11 ] + # deindent closing brace(s) + try %[ execute-keys -draft ^\h*[})]+\h*$ ] = ~ From 043912800775c40ef6ef4b371431e48c5bc147f1 Mon Sep 17 00:00:00 2001 From: John Isom Date: Sun, 26 Jul 2020 20:28:33 -0600 Subject: [PATCH 07/87] Add test cases for go closing brace indentation --- .../go/deindent-function-closing-brace/cmd | 1 + .../go/deindent-function-closing-brace/in | 12 +++++++ .../go/deindent-function-closing-brace/out | 17 +++++++++ .../go/deindent-function-closing-brace/rc | 3 ++ .../go/deindent-generic-closing-brace/cmd | 1 + .../go/deindent-generic-closing-brace/in | 25 +++++++++++++ .../go/deindent-generic-closing-brace/out | 35 +++++++++++++++++++ .../go/deindent-generic-closing-brace/rc | 3 ++ test/indent/go/deindent-if-closing-brace/cmd | 1 + test/indent/go/deindent-if-closing-brace/in | 12 +++++++ test/indent/go/deindent-if-closing-brace/out | 17 +++++++++ test/indent/go/deindent-if-closing-brace/rc | 3 ++ 12 files changed, 130 insertions(+) create mode 100644 test/indent/go/deindent-function-closing-brace/cmd create mode 100644 test/indent/go/deindent-function-closing-brace/in create mode 100644 test/indent/go/deindent-function-closing-brace/out create mode 100644 test/indent/go/deindent-function-closing-brace/rc create mode 100644 test/indent/go/deindent-generic-closing-brace/cmd create mode 100644 test/indent/go/deindent-generic-closing-brace/in create mode 100644 test/indent/go/deindent-generic-closing-brace/out create mode 100644 test/indent/go/deindent-generic-closing-brace/rc create mode 100644 test/indent/go/deindent-if-closing-brace/cmd create mode 100644 test/indent/go/deindent-if-closing-brace/in create mode 100644 test/indent/go/deindent-if-closing-brace/out create mode 100644 test/indent/go/deindent-if-closing-brace/rc diff --git a/test/indent/go/deindent-function-closing-brace/cmd b/test/indent/go/deindent-function-closing-brace/cmd new file mode 100644 index 00000000..e3036a40 --- /dev/null +++ b/test/indent/go/deindent-function-closing-brace/cmd @@ -0,0 +1 @@ +c diff --git a/test/indent/go/deindent-function-closing-brace/in b/test/indent/go/deindent-function-closing-brace/in new file mode 100644 index 00000000..6c56be4e --- /dev/null +++ b/test/indent/go/deindent-function-closing-brace/in @@ -0,0 +1,12 @@ +func foo(x int) int {%( )} + +func foo(x int) int {%( ) +} + +func foo(x int) int {%( )bar()} + +func foo(x int) int {%( )bar() +} + +func foo(x int) int { + bar()%( )} diff --git a/test/indent/go/deindent-function-closing-brace/out b/test/indent/go/deindent-function-closing-brace/out new file mode 100644 index 00000000..a5a15ced --- /dev/null +++ b/test/indent/go/deindent-function-closing-brace/out @@ -0,0 +1,17 @@ +func foo(x int) int { +} + +func foo(x int) int { + +} + +func foo(x int) int { + bar()} + +func foo(x int) int { + bar() +} + +func foo(x int) int { + bar() +} diff --git a/test/indent/go/deindent-function-closing-brace/rc b/test/indent/go/deindent-function-closing-brace/rc new file mode 100644 index 00000000..1b0b0035 --- /dev/null +++ b/test/indent/go/deindent-function-closing-brace/rc @@ -0,0 +1,3 @@ +source "%val{runtime}/colors/default.kak" +source "%val{runtime}/rc/filetype/go.kak" +set buffer filetype go diff --git a/test/indent/go/deindent-generic-closing-brace/cmd b/test/indent/go/deindent-generic-closing-brace/cmd new file mode 100644 index 00000000..e3036a40 --- /dev/null +++ b/test/indent/go/deindent-generic-closing-brace/cmd @@ -0,0 +1 @@ +c diff --git a/test/indent/go/deindent-generic-closing-brace/in b/test/indent/go/deindent-generic-closing-brace/in new file mode 100644 index 00000000..b2f7c26d --- /dev/null +++ b/test/indent/go/deindent-generic-closing-brace/in @@ -0,0 +1,25 @@ +{%( )} + +{%( ) +} + +{%( )bar()} + +{%( )bar() +} + +{ + bar()%( )} + +{(%( ))} + +{(%( ) +)} + +{(%( )foo())} + +{(%( )foo() +)} + +{( + bar()%( ))} diff --git a/test/indent/go/deindent-generic-closing-brace/out b/test/indent/go/deindent-generic-closing-brace/out new file mode 100644 index 00000000..58109817 --- /dev/null +++ b/test/indent/go/deindent-generic-closing-brace/out @@ -0,0 +1,35 @@ +{ +} + +{ + +} + +{ + bar()} + +{ + bar() +} + +{ + bar() +} + +{( +)} + +{( + +)} + +{( + foo())} + +{( + foo() +)} + +{( + bar() +)} diff --git a/test/indent/go/deindent-generic-closing-brace/rc b/test/indent/go/deindent-generic-closing-brace/rc new file mode 100644 index 00000000..1b0b0035 --- /dev/null +++ b/test/indent/go/deindent-generic-closing-brace/rc @@ -0,0 +1,3 @@ +source "%val{runtime}/colors/default.kak" +source "%val{runtime}/rc/filetype/go.kak" +set buffer filetype go diff --git a/test/indent/go/deindent-if-closing-brace/cmd b/test/indent/go/deindent-if-closing-brace/cmd new file mode 100644 index 00000000..e3036a40 --- /dev/null +++ b/test/indent/go/deindent-if-closing-brace/cmd @@ -0,0 +1 @@ +c diff --git a/test/indent/go/deindent-if-closing-brace/in b/test/indent/go/deindent-if-closing-brace/in new file mode 100644 index 00000000..d5f59de0 --- /dev/null +++ b/test/indent/go/deindent-if-closing-brace/in @@ -0,0 +1,12 @@ +if true {%( )} + +if true {%( ) +} + +if true {%( )bar()} + +if true {%( )bar() +} + +if true { + bar()%( )} diff --git a/test/indent/go/deindent-if-closing-brace/out b/test/indent/go/deindent-if-closing-brace/out new file mode 100644 index 00000000..2c63bd1c --- /dev/null +++ b/test/indent/go/deindent-if-closing-brace/out @@ -0,0 +1,17 @@ +if true { +} + +if true { + +} + +if true { + bar()} + +if true { + bar() +} + +if true { + bar() +} diff --git a/test/indent/go/deindent-if-closing-brace/rc b/test/indent/go/deindent-if-closing-brace/rc new file mode 100644 index 00000000..1b0b0035 --- /dev/null +++ b/test/indent/go/deindent-if-closing-brace/rc @@ -0,0 +1,3 @@ +source "%val{runtime}/colors/default.kak" +source "%val{runtime}/rc/filetype/go.kak" +set buffer filetype go From 565e3bef1d0c1bd2a062e84df600bdb32df92813 Mon Sep 17 00:00:00 2001 From: John Isom Date: Sun, 26 Jul 2020 20:46:47 -0600 Subject: [PATCH 08/87] Update comment wording for deindentation --- rc/filetype/c-family.kak | 2 +- rc/filetype/go.kak | 2 +- rc/filetype/rust.kak | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/rc/filetype/c-family.kak b/rc/filetype/c-family.kak index 4d9eca73..31ad1ccc 100644 --- a/rc/filetype/c-family.kak +++ b/rc/filetype/c-family.kak @@ -98,7 +98,7 @@ define-command -hidden c-family-indent-on-newline %< evaluate-commands -draft -i try %< execute-keys -draft K \;\h*(//[^\n]+)?$ \ K s \belse\b\h*(?://[^\n]+)?\n([^\n]*\n){2}\z \ 1 > - # deindent closing brace(s) + # deindent closing brace(s) when after cursor try %< execute-keys -draft ^\h*[})]+\h*$ > # align to the opening parenthesis or opening brace (whichever is first) # on a previous line if its followed by text on the same line diff --git a/rc/filetype/go.kak b/rc/filetype/go.kak index fa81bbed..d947646f 100644 --- a/rc/filetype/go.kak +++ b/rc/filetype/go.kak @@ -89,7 +89,7 @@ define-command -hidden go-indent-on-new-line %~ try %[ execute-keys -draft k ^\h*(case|default).*:$ j ] # indent after if|else|while|for try %[ execute-keys -draft )MB \A(if|else|while|for)\h*\(.*\)\h*\n\h*\n?\z s \A|.\z 11 ] - # deindent closing brace(s) + # deindent closing brace(s) when after cursor try %[ execute-keys -draft ^\h*[})]+\h*$ ] = ~ diff --git a/rc/filetype/rust.kak b/rc/filetype/rust.kak index 55fd2c2b..4b393213 100644 --- a/rc/filetype/rust.kak +++ b/rc/filetype/rust.kak @@ -112,7 +112,7 @@ define-command -hidden rust-indent-on-new-line %~ try %+ execute-keys -draft k ^\h*where\h*$ j + # dedent after lines starting with . and ending with , or ; try %_ execute-keys -draft k ^\h*\..*[,]\h*$ j _ - # deindent closing brace(s) + # deindent closing brace(s) when after cursor try %< execute-keys -draft ^\h*[})]+\h*$ > # todo dedent additional unmatched parenthesis # try %& execute-keys -draft k s \((?:[^)(]+|\((?:[^)(]+|\([^)(]*\))*\))*\) l Gl s\) %sh{ From 2e6e507d4217c836e1b0eeb57f656f103c7ba75f Mon Sep 17 00:00:00 2001 From: John Isom Date: Mon, 27 Jul 2020 11:58:01 -0600 Subject: [PATCH 09/87] Add c-family test cases for bad indentation edge case --- test/indent/c-family/deindent-function-closing-brace/in | 3 +++ test/indent/c-family/deindent-function-closing-brace/out | 4 ++++ test/indent/c-family/deindent-generic-closing-brace/in | 6 ++++++ test/indent/c-family/deindent-generic-closing-brace/out | 8 ++++++++ test/indent/c-family/deindent-if-closing-brace/in | 3 +++ test/indent/c-family/deindent-if-closing-brace/out | 4 ++++ 6 files changed, 28 insertions(+) diff --git a/test/indent/c-family/deindent-function-closing-brace/in b/test/indent/c-family/deindent-function-closing-brace/in index 34193ba9..732f00da 100644 --- a/test/indent/c-family/deindent-function-closing-brace/in +++ b/test/indent/c-family/deindent-function-closing-brace/in @@ -10,3 +10,6 @@ void foo(void) {%( )bar() void foo(void) { bar()%( )} + + void foo(void) { + bar()%( )} diff --git a/test/indent/c-family/deindent-function-closing-brace/out b/test/indent/c-family/deindent-function-closing-brace/out index 827927d0..b507fbee 100644 --- a/test/indent/c-family/deindent-function-closing-brace/out +++ b/test/indent/c-family/deindent-function-closing-brace/out @@ -15,3 +15,7 @@ void foo(void) { void foo(void) { bar() } + + void foo(void) { + bar() + } diff --git a/test/indent/c-family/deindent-generic-closing-brace/in b/test/indent/c-family/deindent-generic-closing-brace/in index b2f7c26d..d7e7a23d 100644 --- a/test/indent/c-family/deindent-generic-closing-brace/in +++ b/test/indent/c-family/deindent-generic-closing-brace/in @@ -23,3 +23,9 @@ {( bar()%( ))} + + { + bar()%( )} + + {( + bar()%( ))} diff --git a/test/indent/c-family/deindent-generic-closing-brace/out b/test/indent/c-family/deindent-generic-closing-brace/out index 58109817..d00507c9 100644 --- a/test/indent/c-family/deindent-generic-closing-brace/out +++ b/test/indent/c-family/deindent-generic-closing-brace/out @@ -33,3 +33,11 @@ {( bar() )} + + { + bar() + } + + {( + bar() + )} diff --git a/test/indent/c-family/deindent-if-closing-brace/in b/test/indent/c-family/deindent-if-closing-brace/in index 8d46bc97..5ac38a34 100644 --- a/test/indent/c-family/deindent-if-closing-brace/in +++ b/test/indent/c-family/deindent-if-closing-brace/in @@ -10,3 +10,6 @@ if (1) {%( )bar() if (1) { bar()%( )} + + if (1) { + bar()%( )} diff --git a/test/indent/c-family/deindent-if-closing-brace/out b/test/indent/c-family/deindent-if-closing-brace/out index df0b059e..d46b84cf 100644 --- a/test/indent/c-family/deindent-if-closing-brace/out +++ b/test/indent/c-family/deindent-if-closing-brace/out @@ -15,3 +15,7 @@ if (1) { if (1) { bar() } + + if (1) { + bar() + } From a7567d82c9e0a70c2571b7926e37866a5a240e3f Mon Sep 17 00:00:00 2001 From: John Isom Date: Mon, 27 Jul 2020 12:02:53 -0600 Subject: [PATCH 10/87] Update c-family brace deindenting to handle bad indentation edge case --- rc/filetype/c-family.kak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rc/filetype/c-family.kak b/rc/filetype/c-family.kak index 31ad1ccc..5817e4b3 100644 --- a/rc/filetype/c-family.kak +++ b/rc/filetype/c-family.kak @@ -99,7 +99,7 @@ define-command -hidden c-family-indent-on-newline %< evaluate-commands -draft -i K s \belse\b\h*(?://[^\n]+)?\n([^\n]*\n){2}\z \ 1 > # deindent closing brace(s) when after cursor - try %< execute-keys -draft ^\h*[})]+\h*$ > + try %< execute-keys -draft ^\h*[})]+\h*$ hm 1 > # align to the opening parenthesis or opening brace (whichever is first) # on a previous line if its followed by text on the same line try %< evaluate-commands -draft %< From 26f4681c3bc7462184accb06d78c4d5ea9082e3a Mon Sep 17 00:00:00 2001 From: John Isom Date: Mon, 27 Jul 2020 12:13:23 -0600 Subject: [PATCH 11/87] Add rust test cases for bad indentation edge case --- test/indent/rust/deindent-function-closing-brace/in | 3 +++ test/indent/rust/deindent-function-closing-brace/out | 4 ++++ test/indent/rust/deindent-generic-closing-brace/in | 6 ++++++ test/indent/rust/deindent-generic-closing-brace/out | 8 ++++++++ test/indent/rust/deindent-if-closing-brace/in | 3 +++ test/indent/rust/deindent-if-closing-brace/out | 4 ++++ 6 files changed, 28 insertions(+) diff --git a/test/indent/rust/deindent-function-closing-brace/in b/test/indent/rust/deindent-function-closing-brace/in index 63c8bb53..ab5cc032 100644 --- a/test/indent/rust/deindent-function-closing-brace/in +++ b/test/indent/rust/deindent-function-closing-brace/in @@ -10,3 +10,6 @@ fn foo() -> i32 {%( )bar() fn foo() -> i32 { bar()%( )} + + fn foo() -> i32 { + bar()%( )} diff --git a/test/indent/rust/deindent-function-closing-brace/out b/test/indent/rust/deindent-function-closing-brace/out index 1a887315..2c58c554 100644 --- a/test/indent/rust/deindent-function-closing-brace/out +++ b/test/indent/rust/deindent-function-closing-brace/out @@ -15,3 +15,7 @@ fn foo() -> i32 { fn foo() -> i32 { bar() } + + fn foo() -> i32 { + bar() + } diff --git a/test/indent/rust/deindent-generic-closing-brace/in b/test/indent/rust/deindent-generic-closing-brace/in index b2f7c26d..21109831 100644 --- a/test/indent/rust/deindent-generic-closing-brace/in +++ b/test/indent/rust/deindent-generic-closing-brace/in @@ -11,6 +11,9 @@ { bar()%( )} + { + bar()%( )} + {(%( ))} {(%( ) @@ -23,3 +26,6 @@ {( bar()%( ))} + + {( + bar()%( ))} diff --git a/test/indent/rust/deindent-generic-closing-brace/out b/test/indent/rust/deindent-generic-closing-brace/out index 58109817..c8615372 100644 --- a/test/indent/rust/deindent-generic-closing-brace/out +++ b/test/indent/rust/deindent-generic-closing-brace/out @@ -16,6 +16,10 @@ bar() } + { + bar() + } + {( )} @@ -33,3 +37,7 @@ {( bar() )} + + {( + bar() + )} diff --git a/test/indent/rust/deindent-if-closing-brace/in b/test/indent/rust/deindent-if-closing-brace/in index d5f59de0..f26c5e62 100644 --- a/test/indent/rust/deindent-if-closing-brace/in +++ b/test/indent/rust/deindent-if-closing-brace/in @@ -10,3 +10,6 @@ if true {%( )bar() if true { bar()%( )} + + if true { + bar()%( )} diff --git a/test/indent/rust/deindent-if-closing-brace/out b/test/indent/rust/deindent-if-closing-brace/out index 2c63bd1c..1276abbe 100644 --- a/test/indent/rust/deindent-if-closing-brace/out +++ b/test/indent/rust/deindent-if-closing-brace/out @@ -15,3 +15,7 @@ if true { if true { bar() } + + if true { + bar() + } From de214d262c2dff13974e4905fbb6a2dc89526736 Mon Sep 17 00:00:00 2001 From: John Isom Date: Mon, 27 Jul 2020 12:15:11 -0600 Subject: [PATCH 12/87] Update rust brace deindenting to handle bad indentation edge case --- rc/filetype/rust.kak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rc/filetype/rust.kak b/rc/filetype/rust.kak index 4b393213..a5f05da2 100644 --- a/rc/filetype/rust.kak +++ b/rc/filetype/rust.kak @@ -113,7 +113,7 @@ define-command -hidden rust-indent-on-new-line %~ # dedent after lines starting with . and ending with , or ; try %_ execute-keys -draft k ^\h*\..*[,]\h*$ j _ # deindent closing brace(s) when after cursor - try %< execute-keys -draft ^\h*[})]+\h*$ > + try %< execute-keys -draft ^\h*[})]+\h*$ hm 1 > # todo dedent additional unmatched parenthesis # try %& execute-keys -draft k s \((?:[^)(]+|\((?:[^)(]+|\([^)(]*\))*\))*\) l Gl s\) %sh{ # count previous selections length From 504d3098940a5b3bc3ed407c2d0c3c3f4944ecdf Mon Sep 17 00:00:00 2001 From: John Isom Date: Mon, 27 Jul 2020 12:18:40 -0600 Subject: [PATCH 13/87] Add go test cases for bad indentation edge case --- test/indent/go/deindent-function-closing-brace/in | 3 +++ test/indent/go/deindent-function-closing-brace/out | 4 ++++ test/indent/go/deindent-generic-closing-brace/in | 6 ++++++ test/indent/go/deindent-generic-closing-brace/out | 8 ++++++++ 4 files changed, 21 insertions(+) diff --git a/test/indent/go/deindent-function-closing-brace/in b/test/indent/go/deindent-function-closing-brace/in index 6c56be4e..a30bf4c4 100644 --- a/test/indent/go/deindent-function-closing-brace/in +++ b/test/indent/go/deindent-function-closing-brace/in @@ -10,3 +10,6 @@ func foo(x int) int {%( )bar() func foo(x int) int { bar()%( )} + + func foo(x int) int { + bar()%( )} diff --git a/test/indent/go/deindent-function-closing-brace/out b/test/indent/go/deindent-function-closing-brace/out index a5a15ced..3a5e4869 100644 --- a/test/indent/go/deindent-function-closing-brace/out +++ b/test/indent/go/deindent-function-closing-brace/out @@ -15,3 +15,7 @@ func foo(x int) int { func foo(x int) int { bar() } + + func foo(x int) int { + bar() + } diff --git a/test/indent/go/deindent-generic-closing-brace/in b/test/indent/go/deindent-generic-closing-brace/in index b2f7c26d..5a31c18f 100644 --- a/test/indent/go/deindent-generic-closing-brace/in +++ b/test/indent/go/deindent-generic-closing-brace/in @@ -11,6 +11,9 @@ { bar()%( )} + { + bar()%( )} + {(%( ))} {(%( ) @@ -23,3 +26,6 @@ {( bar()%( ))} + + {( + bar()%( ))} diff --git a/test/indent/go/deindent-generic-closing-brace/out b/test/indent/go/deindent-generic-closing-brace/out index 58109817..cfd6db40 100644 --- a/test/indent/go/deindent-generic-closing-brace/out +++ b/test/indent/go/deindent-generic-closing-brace/out @@ -16,6 +16,10 @@ bar() } + { + bar() + } + {( )} @@ -33,3 +37,7 @@ {( bar() )} + + {( + bar() + )} From 900450204934e2d17e31054a029e9d63d373a3d6 Mon Sep 17 00:00:00 2001 From: John Isom Date: Mon, 27 Jul 2020 12:19:00 -0600 Subject: [PATCH 14/87] Update go brace deindenting to handle bad indentation edge case --- rc/filetype/go.kak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rc/filetype/go.kak b/rc/filetype/go.kak index d947646f..8899a8c1 100644 --- a/rc/filetype/go.kak +++ b/rc/filetype/go.kak @@ -90,7 +90,7 @@ define-command -hidden go-indent-on-new-line %~ # indent after if|else|while|for try %[ execute-keys -draft )MB \A(if|else|while|for)\h*\(.*\)\h*\n\h*\n?\z s \A|.\z 11 ] # deindent closing brace(s) when after cursor - try %[ execute-keys -draft ^\h*[})]+\h*$ ] + try %[ execute-keys -draft ^\h*[})]+\h*$ hm 1 ] = ~ From 0932f3d441eb9e904282179f4ac667db514df7a3 Mon Sep 17 00:00:00 2001 From: John Isom Date: Mon, 27 Jul 2020 12:55:25 -0600 Subject: [PATCH 15/87] Fix indentation rule for awk.kak --- rc/filetype/awk.kak | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rc/filetype/awk.kak b/rc/filetype/awk.kak index 663174b7..13f3dc64 100644 --- a/rc/filetype/awk.kak +++ b/rc/filetype/awk.kak @@ -76,6 +76,8 @@ define-command -hidden awk-indent-on-new-line %[ try %[ execute-keys -draft k s \h+$ d ] # indent after line ending in opening curly brace try %[ execute-keys -draft k \{\h*(#.*)?$ j ] + # deindent closing brace when after cursor + try %[ execute-keys -draft ^\h*\}\h*(?:#.*)?$ hm 1 ] ] ] From b57b474f2321dc8e7a71c36e97fa7e7ab3b0188f Mon Sep 17 00:00:00 2001 From: John Isom Date: Mon, 27 Jul 2020 12:59:15 -0600 Subject: [PATCH 16/87] Fix indentation rule for cabal.kak --- rc/filetype/cabal.kak | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rc/filetype/cabal.kak b/rc/filetype/cabal.kak index 77519954..a5c043e9 100644 --- a/rc/filetype/cabal.kak +++ b/rc/filetype/cabal.kak @@ -60,6 +60,8 @@ define-command -hidden cabal-indent-on-new-line %[ try %[ execute-keys -draft k : cabal-trim-indent ] # indent after lines ending with { or : try %[ execute-keys -draft k [:{]$ j ] + # deindent closing brace when after cursor + try %[ execute-keys -draft \h*\}\h*(?:--.*)?$ hm 1 ] ] ] From 24afe43cf6537d364f2e96f377cddc6f98f7e0cf Mon Sep 17 00:00:00 2001 From: John Isom Date: Mon, 27 Jul 2020 13:06:24 -0600 Subject: [PATCH 17/87] Fix indentation rule for css.kak --- rc/filetype/css.kak | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rc/filetype/css.kak b/rc/filetype/css.kak index 8825c84e..62a93192 100644 --- a/rc/filetype/css.kak +++ b/rc/filetype/css.kak @@ -71,6 +71,8 @@ define-command -hidden css-indent-on-new-line %[ try %[ execute-keys -draft k : css-trim-indent ] # indent after lines ending with with { try %[ execute-keys -draft k \{$ j ] + # deindent closing brace when after cursor + try %[ execute-keys -draft ^\h*\}\h*$ hm 1 ] ] ] From 1f911f1f8ab71212f90f36c815e37154f1bdce1d Mon Sep 17 00:00:00 2001 From: John Isom Date: Mon, 27 Jul 2020 13:09:18 -0600 Subject: [PATCH 18/87] Fix indentation rule for cue.kak --- rc/filetype/cue.kak | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rc/filetype/cue.kak b/rc/filetype/cue.kak index a2fbb0c7..85a9f318 100644 --- a/rc/filetype/cue.kak +++ b/rc/filetype/cue.kak @@ -136,6 +136,8 @@ define-command -hidden cue-indent-on-new-line %~ try %[ execute-keys -draft k [{(]\h*$ j ] # indent after lines ending with [{(].+ and move first parameter to own line try %< execute-keys -draft [c[({],[)}] \A[({][^\n]+\n[^\n]*\n?\z L i > + # deindent closing brace(s) when after cursor + try %< execute-keys -draft ^\h*[})]+\h*$ hm 1 > | # filter previous line try %{ execute-keys -draft k : cue-trim-indent } From 56837aed57293ace48893a8782e11d10c56a3007 Mon Sep 17 00:00:00 2001 From: John Isom Date: Mon, 27 Jul 2020 13:11:32 -0600 Subject: [PATCH 19/87] Fix indentation rule for dart.kak --- rc/filetype/dart.kak | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rc/filetype/dart.kak b/rc/filetype/dart.kak index 541c1e58..21db0b1e 100644 --- a/rc/filetype/dart.kak +++ b/rc/filetype/dart.kak @@ -97,6 +97,8 @@ define-command -hidden dart-indent-on-new-line %~ try %[ execute-keys -draft k ^\h*(case|default).*:$ j ] # indent after if|else|while|for try %[ execute-keys -draft )MB \A(if|else|while|for)\h*\(.*\)\h*\n\h*\n?\z s \A|.\z 11 ] + # deindent closing brace when after cursor + try %[ execute-keys -draft ^\h*\}\h*$ hm 1 ] = ~ From 8a079dd82fcac2a824471286e1e947f9b1d796fa Mon Sep 17 00:00:00 2001 From: John Isom Date: Mon, 27 Jul 2020 13:15:05 -0600 Subject: [PATCH 20/87] Fix indentation rule for d.kak --- rc/filetype/d.kak | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rc/filetype/d.kak b/rc/filetype/d.kak index 18e547d5..66773a06 100644 --- a/rc/filetype/d.kak +++ b/rc/filetype/d.kak @@ -121,6 +121,8 @@ define-command -hidden d-indent-on-new-line %~ try %[ execute-keys -draft k ^\h*(case|default).*:$ j ] # indent after if|else|while|for try %[ execute-keys -draft )MB \A(if|else|while|for)\h*\(.*\)\h*\n\h*\n?\z s \A|.\z 11 ] + # deindent closing brace(s) when after cursor + try %[ execute-keys -draft ^\h*[})]+\h*$ hm 1 ] = ~ From 931b90a4515eb15646851883bcfa35c46fe5b2ef Mon Sep 17 00:00:00 2001 From: John Isom Date: Mon, 27 Jul 2020 13:38:55 -0600 Subject: [PATCH 21/87] Fix indentation rule for gluon.kak --- rc/filetype/gluon.kak | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rc/filetype/gluon.kak b/rc/filetype/gluon.kak index 2298737c..40ca28a4 100644 --- a/rc/filetype/gluon.kak +++ b/rc/filetype/gluon.kak @@ -93,6 +93,8 @@ define-command -hidden gluon-indent-on-new-line %{ \; k x (\(|\{|\[|=|->|then|else|rec|in)$ j # balance out brackets } ] } + # deindent closing brace(s) when after cursor + try %{ execute-keys -draft ^\h*[})\]]+\h*$ hm 1 } } } From c0e14b1cfd4f476927c72ef0d06d7353e51cc38b Mon Sep 17 00:00:00 2001 From: John Isom Date: Mon, 27 Jul 2020 13:39:50 -0600 Subject: [PATCH 22/87] Fix existing error regarding indent after opening brace This is in gluon.kak, right above my addition --- rc/filetype/gluon.kak | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/rc/filetype/gluon.kak b/rc/filetype/gluon.kak index 40ca28a4..1e62dc99 100644 --- a/rc/filetype/gluon.kak +++ b/rc/filetype/gluon.kak @@ -88,11 +88,7 @@ define-command -hidden gluon-indent-on-new-line %{ try %{ execute-keys -draft k : gluon-trim-indent } # indent after lines ending with (open) braces, =, ->, condition, rec, # or in - try %{ - execute-keys -draft \ - \; k x (\(|\{|\[|=|->|then|else|rec|in)$ j - # balance out brackets } ] - } + try %{ execute-keys -draft \; k x (\(|\{|\[|=|->|then|else|rec|in)$ j } # deindent closing brace(s) when after cursor try %{ execute-keys -draft ^\h*[})\]]+\h*$ hm 1 } } From cd53d313848d5ded4bf33bf480f11b676f381e22 Mon Sep 17 00:00:00 2001 From: John Isom Date: Mon, 27 Jul 2020 13:50:51 -0600 Subject: [PATCH 23/87] Fix indentation rule for java.kak --- rc/filetype/java.kak | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rc/filetype/java.kak b/rc/filetype/java.kak index f6a77f82..a2b18fd1 100644 --- a/rc/filetype/java.kak +++ b/rc/filetype/java.kak @@ -56,6 +56,8 @@ define-command -hidden java-indent-on-new-line %~ try %[ execute-keys -draft k ^\h*(case|default).*:$ j ] # indent after keywords try %[ execute-keys -draft )MB \A(if|else|while|for|try|catch)\h*\(.*\)\h*\n\h*\n?\z s \A|.\z 11 ] + # deindent closing brace(s) when after cursor + try %[ execute-keys -draft ^\h*[})]+\h*$ hm 1 ] = ~ From 2044f250aef78135ce1b9614027d6d40c45d5777 Mon Sep 17 00:00:00 2001 From: John Isom Date: Mon, 27 Jul 2020 20:39:44 -0600 Subject: [PATCH 24/87] Fix indentation rule for javascript.kak --- rc/filetype/javascript.kak | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rc/filetype/javascript.kak b/rc/filetype/javascript.kak index 191ae95d..aae3b89f 100644 --- a/rc/filetype/javascript.kak +++ b/rc/filetype/javascript.kak @@ -62,6 +62,8 @@ define-command -hidden javascript-indent-on-new-line %< try %{ execute-keys -draft k : javascript-trim-indent } # indent after lines beginning / ending with opener token try %_ execute-keys -draft k ^\h*[[{]|[[{]$ j _ + # deindent closing token(s) when after cursor + try %_ execute-keys -draft ^\h*[}\]]+\h*$ hm 1 _ > > From f958a318c196b5dfcd6285a8b08b59d4282b5edb Mon Sep 17 00:00:00 2001 From: John Isom Date: Mon, 27 Jul 2020 20:46:47 -0600 Subject: [PATCH 25/87] Fix already-existing bug in json.kak When a closing brace or bracket is typed, it should automatically match indentation with it's opener. Because of an unescaped ']' literal the regexp didn't work. --- rc/filetype/json.kak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rc/filetype/json.kak b/rc/filetype/json.kak index 2f798b6f..4e7ef874 100644 --- a/rc/filetype/json.kak +++ b/rc/filetype/json.kak @@ -49,7 +49,7 @@ define-command -hidden json-trim-indent %{ define-command -hidden json-indent-on-char %< evaluate-commands -draft -itersel %< # align closer token to its opener when alone on a line - try %< execute-keys -draft ^\h+[]}]$ m s \A|.\z 1 > + try %< execute-keys -draft ^\h+[\]}]$ m s \A|.\z 1 > > > From 8c9afa8a91900dcb0dd42d293e0bcd0ca4491b53 Mon Sep 17 00:00:00 2001 From: John Isom Date: Mon, 27 Jul 2020 20:48:10 -0600 Subject: [PATCH 26/87] Simplify closing brace indentation Edits same line as previous commit. I replaced a complex selection command with a simple 1-keystroke alternative. --- rc/filetype/json.kak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rc/filetype/json.kak b/rc/filetype/json.kak index 4e7ef874..d5a0b8c5 100644 --- a/rc/filetype/json.kak +++ b/rc/filetype/json.kak @@ -49,7 +49,7 @@ define-command -hidden json-trim-indent %{ define-command -hidden json-indent-on-char %< evaluate-commands -draft -itersel %< # align closer token to its opener when alone on a line - try %< execute-keys -draft ^\h+[\]}]$ m s \A|.\z 1 > + try %< execute-keys -draft ^\h+[\]}]$ m 1 > > > From 9dd292d100bf266e391fa9ef3314e2c6a4a447f6 Mon Sep 17 00:00:00 2001 From: John Isom Date: Mon, 27 Jul 2020 20:52:35 -0600 Subject: [PATCH 27/87] Fix indentation rule for json.kak --- rc/filetype/json.kak | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rc/filetype/json.kak b/rc/filetype/json.kak index d5a0b8c5..58f1e328 100644 --- a/rc/filetype/json.kak +++ b/rc/filetype/json.kak @@ -61,6 +61,8 @@ define-command -hidden json-indent-on-new-line %< try %{ execute-keys -draft k : json-trim-indent } # indent after lines beginning with opener token try %< execute-keys -draft k ^\h*[[{] j > + # deindent opener token(s) when after cursor + try %< execute-keys -draft ^\h*[}\]]+\h*$ hm 1 > > > From 01712e7f3cdedfb178470e6a73bab35e7b5f94ec Mon Sep 17 00:00:00 2001 From: John Isom Date: Mon, 27 Jul 2020 20:55:34 -0600 Subject: [PATCH 28/87] Change indentation rules in json.kak to be much more intuitive for nested objects As it was before, when you had this (| = cursor): ``` json { "foo": {| } ``` and hit , this would happen: ``` json { "foo": { | } ``` when it should have been this: ``` json { "foo": { | } ``` --- rc/filetype/json.kak | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rc/filetype/json.kak b/rc/filetype/json.kak index 58f1e328..994ffc5e 100644 --- a/rc/filetype/json.kak +++ b/rc/filetype/json.kak @@ -59,8 +59,8 @@ define-command -hidden json-indent-on-new-line %< try %{ execute-keys -draft K } # filter previous line try %{ execute-keys -draft k : json-trim-indent } - # indent after lines beginning with opener token - try %< execute-keys -draft k ^\h*[[{] j > + # indent after lines ending with opener token + try %< execute-keys -draft k [[{]\h*$ j > # deindent opener token(s) when after cursor try %< execute-keys -draft ^\h*[}\]]+\h*$ hm 1 > > From fd3716a12b2715aacd68e6b6db3d44739c71d8ca Mon Sep 17 00:00:00 2001 From: John Isom Date: Mon, 27 Jul 2020 20:58:25 -0600 Subject: [PATCH 29/87] Fix typo in comment from 9dd292d100bf266e391fa9ef3314e2c6a4a447f6 --- rc/filetype/json.kak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rc/filetype/json.kak b/rc/filetype/json.kak index 994ffc5e..24ca7a36 100644 --- a/rc/filetype/json.kak +++ b/rc/filetype/json.kak @@ -61,7 +61,7 @@ define-command -hidden json-indent-on-new-line %< try %{ execute-keys -draft k : json-trim-indent } # indent after lines ending with opener token try %< execute-keys -draft k [[{]\h*$ j > - # deindent opener token(s) when after cursor + # deindent closer token(s) when after cursor try %< execute-keys -draft ^\h*[}\]]+\h*$ hm 1 > > > From d818ff8ac0eb32c367e1e8a04fb5268ff5658a47 Mon Sep 17 00:00:00 2001 From: John Isom Date: Mon, 27 Jul 2020 21:21:33 -0600 Subject: [PATCH 30/87] Fix indentation for closing braces in kakrc.kak This fixes %{ }, %< > style, not %| |, %= =, etc --- rc/filetype/kakrc.kak | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/rc/filetype/kakrc.kak b/rc/filetype/kakrc.kak index 2a2f505f..951afb42 100644 --- a/rc/filetype/kakrc.kak +++ b/rc/filetype/kakrc.kak @@ -90,8 +90,8 @@ add-highlighter shared/kakrc/single_string/escape regex "''" 0:default+b # Commands # ‾‾‾‾‾‾‾‾ -define-command -hidden kak-indent-on-new-line %{ - evaluate-commands -draft -itersel %{ +define-command -hidden kak-indent-on-new-line %~ + evaluate-commands -draft -itersel %= # copy '#' comment prefix and following white spaces try %{ execute-keys -draft k s ^\h*#\h* y jgh P } # preserve previous line indent @@ -100,8 +100,10 @@ define-command -hidden kak-indent-on-new-line %{ try %{ execute-keys -draft k s \h+$ d } # indent after line ending with %\w*[^\s\w] try %{ execute-keys -draft k \%\w*[^\s\w]$ j } - } -} + # deindent closing brace when after cursor + try %_ execute-keys -draft -itersel ^\h*[>)}\]]\h*$ hm 1 _ + = +~ define-command -hidden kak-indent-on-closing-matching %~ # align to opening matching brace when alone on a line From d4fee6b197f41211a9d5948463c0f804eccb3f8f Mon Sep 17 00:00:00 2001 From: John Isom Date: Mon, 27 Jul 2020 21:37:49 -0600 Subject: [PATCH 31/87] Fix indentation for closing chars in kakrc.kak --- rc/filetype/kakrc.kak | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rc/filetype/kakrc.kak b/rc/filetype/kakrc.kak index 951afb42..2a0765dd 100644 --- a/rc/filetype/kakrc.kak +++ b/rc/filetype/kakrc.kak @@ -102,6 +102,8 @@ define-command -hidden kak-indent-on-new-line %~ try %{ execute-keys -draft k \%\w*[^\s\w]$ j } # deindent closing brace when after cursor try %_ execute-keys -draft -itersel ^\h*[>)}\]]\h*$ hm 1 _ + # deindent closing char(s) + try %{ execute-keys -draft -itersel ^\h*([^\s\w])\h*$ h 1 % \w*1$ 1 } = ~ From b40a53d26cdab62b048bbc6f6c2e21eb2fec2d90 Mon Sep 17 00:00:00 2001 From: John Isom Date: Mon, 27 Jul 2020 21:42:44 -0600 Subject: [PATCH 32/87] Remove extraneous -itersel flag from deindent closing brace after cursor --- rc/filetype/kakrc.kak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rc/filetype/kakrc.kak b/rc/filetype/kakrc.kak index 2a0765dd..024e1076 100644 --- a/rc/filetype/kakrc.kak +++ b/rc/filetype/kakrc.kak @@ -101,7 +101,7 @@ define-command -hidden kak-indent-on-new-line %~ # indent after line ending with %\w*[^\s\w] try %{ execute-keys -draft k \%\w*[^\s\w]$ j } # deindent closing brace when after cursor - try %_ execute-keys -draft -itersel ^\h*[>)}\]]\h*$ hm 1 _ + try %_ execute-keys -draft ^\h*[>)}\]]\h*$ hm 1 _ # deindent closing char(s) try %{ execute-keys -draft -itersel ^\h*([^\s\w])\h*$ h 1 % \w*1$ 1 } = From 1d68f8dab9666dbbf6c7df1dc948c2477cc464c8 Mon Sep 17 00:00:00 2001 From: John Isom Date: Mon, 27 Jul 2020 21:43:07 -0600 Subject: [PATCH 33/87] Fix indentation rule for latex.kak --- rc/filetype/latex.kak | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rc/filetype/latex.kak b/rc/filetype/latex.kak index af336f68..34b6f208 100644 --- a/rc/filetype/latex.kak +++ b/rc/filetype/latex.kak @@ -68,6 +68,8 @@ define-command -hidden latex-indent-newline %( try %{ execute-keys -draft k s\h+$ d } # indent after line ending with { try %( execute-keys -draft k \{$ j ) + # deindent closing brace(s) when after cursor + try %( execute-keys -draft ^\h*\}+\h*$ hm 1 ) # indent after line ending with \begin{...}[...]{...}, with multiple # sets of arguments possible try %( From 05e8eaac68b800bd42a644e6ab9a671b1d6bda3e Mon Sep 17 00:00:00 2001 From: John Isom Date: Mon, 27 Jul 2020 21:58:48 -0600 Subject: [PATCH 34/87] Fix indentation rule for nix.kak --- rc/filetype/nix.kak | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rc/filetype/nix.kak b/rc/filetype/nix.kak index 36137552..244c3bda 100644 --- a/rc/filetype/nix.kak +++ b/rc/filetype/nix.kak @@ -109,6 +109,8 @@ define-command -hidden nix-indent-on-new-line %< try %{ execute-keys -draft k : nix-trim-indent } # indent after lines beginning / ending with opener token try %_ execute-keys -draft k ^\h*[[{]|[[{]$ j _ + # deindent closer token(s) when after cursor + try %_ execute-keys -draft ^\h*[}\]]+\h*$ hm 1 _ > > From 80a5fd2c883e1a0cabd0c4f1b3a31f11fc5f5813 Mon Sep 17 00:00:00 2001 From: John Isom Date: Mon, 27 Jul 2020 21:59:08 -0600 Subject: [PATCH 35/87] Fix already-existing bug in nix.kak --- rc/filetype/nix.kak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rc/filetype/nix.kak b/rc/filetype/nix.kak index 244c3bda..9fc4dc66 100644 --- a/rc/filetype/nix.kak +++ b/rc/filetype/nix.kak @@ -95,7 +95,7 @@ define-command -hidden nix-trim-indent %{ define-command -hidden nix-indent-on-char %< evaluate-commands -draft -itersel %< # align closer token to its opener when alone on a line - try %/ execute-keys -draft ^\h+[]}]$ m s \A|.\z 1 / + try %/ execute-keys -draft ^\h+[\]}]$ m s \A|.\z 1 / > > From 85d5f503767238cb3b73a5e578f9354dd11ab669 Mon Sep 17 00:00:00 2001 From: John Isom Date: Tue, 28 Jul 2020 12:55:21 -0600 Subject: [PATCH 36/87] Fix indentation rule for perl.kak --- rc/filetype/perl.kak | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rc/filetype/perl.kak b/rc/filetype/perl.kak index a2da7cf9..e2150a1b 100644 --- a/rc/filetype/perl.kak +++ b/rc/filetype/perl.kak @@ -117,6 +117,8 @@ define-command -hidden perl-indent-on-new-line %~ try %[ execute-keys -draft k ^\h*(case|default).*:$ j ] # indent after if|else|while|for try %[ execute-keys -draft )MB \A(if|else|while|for)\h*\(.*\)\h*\n\h*\n?\z s \A|.\z 11 ] + # deindent closing brace(s) when after cursor + try %[ execute-keys -draft ^\h*[})]+\h*$ hm 1 ] = ~ From 94ab56d123c07b0318583ac10d45706a1729e58f Mon Sep 17 00:00:00 2001 From: John Isom Date: Tue, 28 Jul 2020 14:18:09 -0600 Subject: [PATCH 37/87] Fix indentation rule for php.kak --- rc/filetype/php.kak | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/rc/filetype/php.kak b/rc/filetype/php.kak index e296b4fa..6ecd8728 100644 --- a/rc/filetype/php.kak +++ b/rc/filetype/php.kak @@ -23,7 +23,7 @@ hook -group php-highlight global WinSetOption filetype=php %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/php-file } } -provide-module php %( +provide-module php %§ require-module html # Highlighters @@ -93,7 +93,9 @@ define-command -hidden php-indent-on-new-line %< try %_ execute-keys -draft k ^\h*[[{]|[[{]$ j _ # append " * " on lines starting a multiline /** or /* comment try %{ execute-keys -draft k s ^\h*/[*][* ]? j gi i * } + # deindent closer token(s) when after cursor + try %_ execute-keys -draft ^\h*[})]+\h*$ hm 1 _ > > -) +§ From d7e97022284fd386e2058083861ee1220661bc65 Mon Sep 17 00:00:00 2001 From: John Isom Date: Tue, 28 Jul 2020 15:18:57 -0600 Subject: [PATCH 38/87] Fix my closer tokens issues in javascript.kak --- rc/filetype/javascript.kak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rc/filetype/javascript.kak b/rc/filetype/javascript.kak index aae3b89f..a3d19357 100644 --- a/rc/filetype/javascript.kak +++ b/rc/filetype/javascript.kak @@ -63,7 +63,7 @@ define-command -hidden javascript-indent-on-new-line %< # indent after lines beginning / ending with opener token try %_ execute-keys -draft k ^\h*[[{]|[[{]$ j _ # deindent closing token(s) when after cursor - try %_ execute-keys -draft ^\h*[}\]]+\h*$ hm 1 _ + try %_ execute-keys -draft ^\h*[}\]]+\;?\h*$ \; [}\]] m 1 _ > > From 60a1b0cfcb461d3fdaec16feac1fa8fb44cc2f6d Mon Sep 17 00:00:00 2001 From: John Isom Date: Tue, 28 Jul 2020 15:33:20 -0600 Subject: [PATCH 39/87] Update deindenting in javascript.kak --- rc/filetype/javascript.kak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rc/filetype/javascript.kak b/rc/filetype/javascript.kak index a3d19357..4f1b0723 100644 --- a/rc/filetype/javascript.kak +++ b/rc/filetype/javascript.kak @@ -63,7 +63,7 @@ define-command -hidden javascript-indent-on-new-line %< # indent after lines beginning / ending with opener token try %_ execute-keys -draft k ^\h*[[{]|[[{]$ j _ # deindent closing token(s) when after cursor - try %_ execute-keys -draft ^\h*[}\]]+\;?\h*$ \; [}\]] m 1 _ + try %_ execute-keys -draft ^\h*[}\]]+\h*\;?\h*$ \; [}\]] m 1 _ > > From ec48e07b2aa8683227384815516fe77d6cb7367f Mon Sep 17 00:00:00 2001 From: John Isom Date: Tue, 28 Jul 2020 15:59:13 -0600 Subject: [PATCH 40/87] Update deindenting in dart.kak --- rc/filetype/dart.kak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rc/filetype/dart.kak b/rc/filetype/dart.kak index 21db0b1e..b55306aa 100644 --- a/rc/filetype/dart.kak +++ b/rc/filetype/dart.kak @@ -98,7 +98,7 @@ define-command -hidden dart-indent-on-new-line %~ # indent after if|else|while|for try %[ execute-keys -draft )MB \A(if|else|while|for)\h*\(.*\)\h*\n\h*\n?\z s \A|.\z 11 ] # deindent closing brace when after cursor - try %[ execute-keys -draft ^\h*\}\h*$ hm 1 ] + try %[ execute-keys -draft ^\h*\}\h*\;?\h*(?://.*)?$ \} m 1 ] = ~ From f3f477aa044665954201a5721aa5e5ce75768c10 Mon Sep 17 00:00:00 2001 From: John Isom Date: Tue, 28 Jul 2020 16:01:11 -0600 Subject: [PATCH 41/87] Fix already-existing error in cabal.kak --- rc/filetype/cabal.kak | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rc/filetype/cabal.kak b/rc/filetype/cabal.kak index a5c043e9..8f7a6975 100644 --- a/rc/filetype/cabal.kak +++ b/rc/filetype/cabal.kak @@ -52,8 +52,8 @@ define-command -hidden cabal-trim-indent %{ define-command -hidden cabal-indent-on-new-line %[ evaluate-commands -draft -itersel %[ - # copy '#' comment prefix and following white spaces - try %[ execute-keys -draft k s ^\h*\K#\h* y gh j P ] + # copy '--' comment prefix and following white spaces + try %[ execute-keys -draft k s ^\h*\K--\h* y gh j P ] # preserve previous line indent try %[ execute-keys -draft K ] # filter previous line From 6cf0856a15e9456300860ff323ee7d771b911485 Mon Sep 17 00:00:00 2001 From: John Isom Date: Tue, 28 Jul 2020 16:02:31 -0600 Subject: [PATCH 42/87] Update deindenting in cabal.kak --- rc/filetype/cabal.kak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rc/filetype/cabal.kak b/rc/filetype/cabal.kak index 8f7a6975..38e54277 100644 --- a/rc/filetype/cabal.kak +++ b/rc/filetype/cabal.kak @@ -61,7 +61,7 @@ define-command -hidden cabal-indent-on-new-line %[ # indent after lines ending with { or : try %[ execute-keys -draft k [:{]$ j ] # deindent closing brace when after cursor - try %[ execute-keys -draft \h*\}\h*(?:--.*)?$ hm 1 ] + try %[ execute-keys -draft \h*\}\h*(?:--.*)?$ \} m 1 ] ] ] From 8f0b56be1fa1e2bbd94513dedac2d8c81c65bcd6 Mon Sep 17 00:00:00 2001 From: John Isom Date: Tue, 28 Jul 2020 16:03:15 -0600 Subject: [PATCH 43/87] Update deindenting in css.kak --- rc/filetype/css.kak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rc/filetype/css.kak b/rc/filetype/css.kak index 62a93192..4522effb 100644 --- a/rc/filetype/css.kak +++ b/rc/filetype/css.kak @@ -72,7 +72,7 @@ define-command -hidden css-indent-on-new-line %[ # indent after lines ending with with { try %[ execute-keys -draft k \{$ j ] # deindent closing brace when after cursor - try %[ execute-keys -draft ^\h*\}\h*$ hm 1 ] + try %[ execute-keys -draft ^\h*\}\h*$ \} m 1 ] ] ] From 3bd783c3371ae26fdb22c8a6189a848482be2dc1 Mon Sep 17 00:00:00 2001 From: John Isom Date: Tue, 28 Jul 2020 16:04:35 -0600 Subject: [PATCH 44/87] Update deindenting in perl.kak --- rc/filetype/perl.kak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rc/filetype/perl.kak b/rc/filetype/perl.kak index e2150a1b..aacab43f 100644 --- a/rc/filetype/perl.kak +++ b/rc/filetype/perl.kak @@ -118,7 +118,7 @@ define-command -hidden perl-indent-on-new-line %~ # indent after if|else|while|for try %[ execute-keys -draft )MB \A(if|else|while|for)\h*\(.*\)\h*\n\h*\n?\z s \A|.\z 11 ] # deindent closing brace(s) when after cursor - try %[ execute-keys -draft ^\h*[})]+\h*$ hm 1 ] + try %[ execute-keys -draft ^\h*[})]+\h*(?://.*)?$ [})] m 1 ] = ~ From be69d6e1731d7876c20c702ea6e4ad328ba0a0a1 Mon Sep 17 00:00:00 2001 From: John Isom Date: Tue, 28 Jul 2020 16:06:02 -0600 Subject: [PATCH 45/87] Update deindenting in latex.kak --- rc/filetype/latex.kak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rc/filetype/latex.kak b/rc/filetype/latex.kak index 34b6f208..38bf7882 100644 --- a/rc/filetype/latex.kak +++ b/rc/filetype/latex.kak @@ -69,7 +69,7 @@ define-command -hidden latex-indent-newline %( # indent after line ending with { try %( execute-keys -draft k \{$ j ) # deindent closing brace(s) when after cursor - try %( execute-keys -draft ^\h*\}+\h*$ hm 1 ) + try %( execute-keys -draft ^\h*\}+\h*(?:%.*)?$ \} m 1 ) # indent after line ending with \begin{...}[...]{...}, with multiple # sets of arguments possible try %( From 70e68e3064a46583cfda7ab666cb5878636088e9 Mon Sep 17 00:00:00 2001 From: John Isom Date: Tue, 28 Jul 2020 16:07:03 -0600 Subject: [PATCH 46/87] Update deindenting in php.kak --- rc/filetype/php.kak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rc/filetype/php.kak b/rc/filetype/php.kak index 6ecd8728..9b43bb68 100644 --- a/rc/filetype/php.kak +++ b/rc/filetype/php.kak @@ -94,7 +94,7 @@ define-command -hidden php-indent-on-new-line %< # append " * " on lines starting a multiline /** or /* comment try %{ execute-keys -draft k s ^\h*/[*][* ]? j gi i * } # deindent closer token(s) when after cursor - try %_ execute-keys -draft ^\h*[})]+\h*$ hm 1 _ + try %_ execute-keys -draft ^\h*[})]+\h*(?://.*)?$ [})] m 1 _ > > From 6d534802985f19bac4cd16c8c7937fbe43a27a5f Mon Sep 17 00:00:00 2001 From: John Isom Date: Tue, 28 Jul 2020 16:08:41 -0600 Subject: [PATCH 47/87] Update deindenting in rust.kak --- rc/filetype/rust.kak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rc/filetype/rust.kak b/rc/filetype/rust.kak index a5f05da2..f6cc0f70 100644 --- a/rc/filetype/rust.kak +++ b/rc/filetype/rust.kak @@ -113,7 +113,7 @@ define-command -hidden rust-indent-on-new-line %~ # dedent after lines starting with . and ending with , or ; try %_ execute-keys -draft k ^\h*\..*[,]\h*$ j _ # deindent closing brace(s) when after cursor - try %< execute-keys -draft ^\h*[})]+\h*$ hm 1 > + try %< execute-keys -draft ^\h*[})]+\h*(?://.*|/\*.*\*/)?$ [})] m 1 > # todo dedent additional unmatched parenthesis # try %& execute-keys -draft k s \((?:[^)(]+|\((?:[^)(]+|\([^)(]*\))*\))*\) l Gl s\) %sh{ # count previous selections length From 2de803ee17209bd689541699f661d16b723b75a1 Mon Sep 17 00:00:00 2001 From: John Isom Date: Tue, 28 Jul 2020 16:08:41 -0600 Subject: [PATCH 48/87] Update deindenting in rust.kak --- rc/filetype/rust.kak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rc/filetype/rust.kak b/rc/filetype/rust.kak index a5f05da2..92d5cfa8 100644 --- a/rc/filetype/rust.kak +++ b/rc/filetype/rust.kak @@ -113,7 +113,7 @@ define-command -hidden rust-indent-on-new-line %~ # dedent after lines starting with . and ending with , or ; try %_ execute-keys -draft k ^\h*\..*[,]\h*$ j _ # deindent closing brace(s) when after cursor - try %< execute-keys -draft ^\h*[})]+\h*$ hm 1 > + try %= execute-keys -draft ^\h*[})]+\h*$ \; [})] m 1 = # todo dedent additional unmatched parenthesis # try %& execute-keys -draft k s \((?:[^)(]+|\((?:[^)(]+|\([^)(]*\))*\))*\) l Gl s\) %sh{ # count previous selections length From b87b1bd32d5ea65dccc5bf22149e394ef84cf31a Mon Sep 17 00:00:00 2001 From: John Isom Date: Tue, 28 Jul 2020 20:49:17 -0600 Subject: [PATCH 49/87] Update deindenting in php.kak --- rc/filetype/php.kak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rc/filetype/php.kak b/rc/filetype/php.kak index 9b43bb68..3c922e78 100644 --- a/rc/filetype/php.kak +++ b/rc/filetype/php.kak @@ -94,7 +94,7 @@ define-command -hidden php-indent-on-new-line %< # append " * " on lines starting a multiline /** or /* comment try %{ execute-keys -draft k s ^\h*/[*][* ]? j gi i * } # deindent closer token(s) when after cursor - try %_ execute-keys -draft ^\h*[})]+\h*(?://.*)?$ [})] m 1 _ + try %_ execute-keys -draft ^\h*[})]+\h*(?://.*)?$ \; [})] m 1 _ > > From a5a3ce9e1bd264088c2afd99d3acfb3e031ead38 Mon Sep 17 00:00:00 2001 From: John Isom Date: Tue, 28 Jul 2020 20:49:42 -0600 Subject: [PATCH 50/87] Fix already-existing error in php.kak --- rc/filetype/php.kak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rc/filetype/php.kak b/rc/filetype/php.kak index 3c922e78..075b0eb8 100644 --- a/rc/filetype/php.kak +++ b/rc/filetype/php.kak @@ -77,7 +77,7 @@ define-command -hidden php-trim-indent %{ define-command -hidden php-indent-on-char %< evaluate-commands -draft -itersel %< # align closer token to its opener when alone on a line - try %/ execute-keys -draft ^\h+[]}]$ m s \A|.\z 1 / + try %/ execute-keys -draft ^\h+[\]}]$ m s \A|.\z 1 / > > From 9edbcd4a4605180e8b99bb358ae1ab274b7dedd1 Mon Sep 17 00:00:00 2001 From: John Isom Date: Tue, 28 Jul 2020 20:50:19 -0600 Subject: [PATCH 51/87] Update deindenting in dart.kak --- rc/filetype/dart.kak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rc/filetype/dart.kak b/rc/filetype/dart.kak index b55306aa..70e4fcb7 100644 --- a/rc/filetype/dart.kak +++ b/rc/filetype/dart.kak @@ -98,7 +98,7 @@ define-command -hidden dart-indent-on-new-line %~ # indent after if|else|while|for try %[ execute-keys -draft )MB \A(if|else|while|for)\h*\(.*\)\h*\n\h*\n?\z s \A|.\z 11 ] # deindent closing brace when after cursor - try %[ execute-keys -draft ^\h*\}\h*\;?\h*(?://.*)?$ \} m 1 ] + try %[ execute-keys -draft ^\h*\}\h*\;?\h*(?://.*)?$ \; \} m 1 ] = ~ From 655c7aad6084b470ef72b045f6d228f143ac1dd8 Mon Sep 17 00:00:00 2001 From: John Isom Date: Tue, 28 Jul 2020 20:50:36 -0600 Subject: [PATCH 52/87] Update deindenting in cabal.kak --- rc/filetype/cabal.kak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rc/filetype/cabal.kak b/rc/filetype/cabal.kak index 38e54277..d721b1c6 100644 --- a/rc/filetype/cabal.kak +++ b/rc/filetype/cabal.kak @@ -61,7 +61,7 @@ define-command -hidden cabal-indent-on-new-line %[ # indent after lines ending with { or : try %[ execute-keys -draft k [:{]$ j ] # deindent closing brace when after cursor - try %[ execute-keys -draft \h*\}\h*(?:--.*)?$ \} m 1 ] + try %[ execute-keys -draft \h*\}\h*(?:--.*)?$ \; \} m 1 ] ] ] From 84a08982db6abbc9f516436a3b361e1a3c64efab Mon Sep 17 00:00:00 2001 From: John Isom Date: Tue, 28 Jul 2020 20:51:19 -0600 Subject: [PATCH 53/87] Update deindenting in perl.kak --- rc/filetype/perl.kak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rc/filetype/perl.kak b/rc/filetype/perl.kak index aacab43f..d3f03ed2 100644 --- a/rc/filetype/perl.kak +++ b/rc/filetype/perl.kak @@ -118,7 +118,7 @@ define-command -hidden perl-indent-on-new-line %~ # indent after if|else|while|for try %[ execute-keys -draft )MB \A(if|else|while|for)\h*\(.*\)\h*\n\h*\n?\z s \A|.\z 11 ] # deindent closing brace(s) when after cursor - try %[ execute-keys -draft ^\h*[})]+\h*(?://.*)?$ [})] m 1 ] + try %[ execute-keys -draft ^\h*[})]+\h*(?:#.*)?$ [})] m 1 ] = ~ From 507f799ce499006948509066e5750c3a82e496df Mon Sep 17 00:00:00 2001 From: John Isom Date: Tue, 28 Jul 2020 20:52:06 -0600 Subject: [PATCH 54/87] Fix already-existing bug in perl.kak --- rc/filetype/perl.kak | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rc/filetype/perl.kak b/rc/filetype/perl.kak index d3f03ed2..d94f27d4 100644 --- a/rc/filetype/perl.kak +++ b/rc/filetype/perl.kak @@ -111,8 +111,8 @@ define-command -hidden perl-indent-on-new-line %~ try %{ execute-keys -draft k s \h+$ d } # align to opening paren of previous line try %{ execute-keys -draft [( \A\([^\n]+\n[^\n]*\n?\z s \A\(\h*.|.\z '' & } - # copy // comments prefix - try %{ execute-keys -draft k s ^\h*\K/{2,} yP } + # copy # comments prefix + try %{ execute-keys -draft k s ^\h*\K# yP } # indent after a switch's case/default statements try %[ execute-keys -draft k ^\h*(case|default).*:$ j ] # indent after if|else|while|for From ba8fca741c3d021c9bc4f117b0c9536992a5c1b8 Mon Sep 17 00:00:00 2001 From: John Isom Date: Wed, 29 Jul 2020 08:52:04 -0600 Subject: [PATCH 55/87] Update deindenting in kakrc.kak --- rc/filetype/kakrc.kak | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rc/filetype/kakrc.kak b/rc/filetype/kakrc.kak index 024e1076..4bf2966e 100644 --- a/rc/filetype/kakrc.kak +++ b/rc/filetype/kakrc.kak @@ -101,9 +101,9 @@ define-command -hidden kak-indent-on-new-line %~ # indent after line ending with %\w*[^\s\w] try %{ execute-keys -draft k \%\w*[^\s\w]$ j } # deindent closing brace when after cursor - try %_ execute-keys -draft ^\h*[>)}\]]\h*$ hm 1 _ + try %_ execute-keys -draft -itersel ^\h*([>)}\]])\h*(?:\h#.*)?$ 1 m 1 _ # deindent closing char(s) - try %{ execute-keys -draft -itersel ^\h*([^\s\w])\h*$ h 1 % \w*1$ 1 } + try %{ execute-keys -draft -itersel ^\h*([^\s\w])\h*(?:\h#.*)?$ 1 1 % \w*1$ 1 } = ~ From 623743e794a03c76c515e5ad75d7cf16a67b034b Mon Sep 17 00:00:00 2001 From: John Isom Date: Tue, 28 Jul 2020 20:51:19 -0600 Subject: [PATCH 56/87] Update deindenting in perl.kak --- rc/filetype/perl.kak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rc/filetype/perl.kak b/rc/filetype/perl.kak index aacab43f..8ca94c1f 100644 --- a/rc/filetype/perl.kak +++ b/rc/filetype/perl.kak @@ -118,7 +118,7 @@ define-command -hidden perl-indent-on-new-line %~ # indent after if|else|while|for try %[ execute-keys -draft )MB \A(if|else|while|for)\h*\(.*\)\h*\n\h*\n?\z s \A|.\z 11 ] # deindent closing brace(s) when after cursor - try %[ execute-keys -draft ^\h*[})]+\h*(?://.*)?$ [})] m 1 ] + try %[ execute-keys -draft ^\h*[})]+\h*(?:#.*)?$ \; [})] m 1 ] = ~ From fb838b9f33b8cf7c8af69940a6330e583386eb1e Mon Sep 17 00:00:00 2001 From: John Isom Date: Wed, 29 Jul 2020 08:56:19 -0600 Subject: [PATCH 57/87] Update deindenting in perl.kak --- rc/filetype/perl.kak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rc/filetype/perl.kak b/rc/filetype/perl.kak index 0231d632..9fa14bb8 100644 --- a/rc/filetype/perl.kak +++ b/rc/filetype/perl.kak @@ -118,7 +118,7 @@ define-command -hidden perl-indent-on-new-line %~ # indent after if|else|while|for try %[ execute-keys -draft )MB \A(if|else|while|for)\h*\(.*\)\h*\n\h*\n?\z s \A|.\z 11 ] # deindent closing brace(s) when after cursor - try %[ execute-keys -draft ^\h*[})]+\h*(?://.*)?$ \; [})] m 1 ] + try %[ execute-keys -draft ^\h*[})]+\h*(?:#.*)?$ \; [})] m 1 ] = ~ From dc4508d05f913ab70816ab7fdfb185ab3d650043 Mon Sep 17 00:00:00 2001 From: John Isom Date: Wed, 29 Jul 2020 09:07:02 -0600 Subject: [PATCH 58/87] Update deindenting in d.kak --- rc/filetype/d.kak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rc/filetype/d.kak b/rc/filetype/d.kak index 66773a06..8bf40e26 100644 --- a/rc/filetype/d.kak +++ b/rc/filetype/d.kak @@ -122,7 +122,7 @@ define-command -hidden d-indent-on-new-line %~ # indent after if|else|while|for try %[ execute-keys -draft )MB \A(if|else|while|for)\h*\(.*\)\h*\n\h*\n?\z s \A|.\z 11 ] # deindent closing brace(s) when after cursor - try %[ execute-keys -draft ^\h*[})]+\h*$ hm 1 ] + try %[ execute-keys -draft ^\h*[})]+\h*\;?\h*(?://.*)?$ \; [})] m 1 ] = ~ From f84fd84b263b24ca1047c27998b408c0ac8e6e4e Mon Sep 17 00:00:00 2001 From: John Isom Date: Wed, 29 Jul 2020 09:27:20 -0600 Subject: [PATCH 59/87] Update deindenting in json.kak --- rc/filetype/json.kak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rc/filetype/json.kak b/rc/filetype/json.kak index 24ca7a36..76b4e861 100644 --- a/rc/filetype/json.kak +++ b/rc/filetype/json.kak @@ -62,7 +62,7 @@ define-command -hidden json-indent-on-new-line %< # indent after lines ending with opener token try %< execute-keys -draft k [[{]\h*$ j > # deindent closer token(s) when after cursor - try %< execute-keys -draft ^\h*[}\]]+\h*$ hm 1 > + try %< execute-keys -draft ^\h*[}\]]+ \; gh / [}\]] m 1 > > > From 27705d402f93588b35a1ea83853c7f402e8d4816 Mon Sep 17 00:00:00 2001 From: John Isom Date: Wed, 29 Jul 2020 09:28:32 -0600 Subject: [PATCH 60/87] Update deindenting in javascript.kak --- rc/filetype/javascript.kak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rc/filetype/javascript.kak b/rc/filetype/javascript.kak index 4f1b0723..bd9f586a 100644 --- a/rc/filetype/javascript.kak +++ b/rc/filetype/javascript.kak @@ -63,7 +63,7 @@ define-command -hidden javascript-indent-on-new-line %< # indent after lines beginning / ending with opener token try %_ execute-keys -draft k ^\h*[[{]|[[{]$ j _ # deindent closing token(s) when after cursor - try %_ execute-keys -draft ^\h*[}\]]+\h*\;?\h*$ \; [}\]] m 1 _ + try %_ execute-keys -draft ^\h*[})\]]+ \; gh / [})\]] m 1 _ > > From 2b86826d5a1fd35bb6be17a79dfe43fa7e58f633 Mon Sep 17 00:00:00 2001 From: John Isom Date: Wed, 29 Jul 2020 09:28:46 -0600 Subject: [PATCH 61/87] Fix already-existing error in javascript.kak --- rc/filetype/javascript.kak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rc/filetype/javascript.kak b/rc/filetype/javascript.kak index bd9f586a..a3bc0654 100644 --- a/rc/filetype/javascript.kak +++ b/rc/filetype/javascript.kak @@ -61,7 +61,7 @@ define-command -hidden javascript-indent-on-new-line %< # filter previous line try %{ execute-keys -draft k : javascript-trim-indent } # indent after lines beginning / ending with opener token - try %_ execute-keys -draft k ^\h*[[{]|[[{]$ j _ + try %_ execute-keys -draft k ^\h*[[({]|[[({]$ j _ # deindent closing token(s) when after cursor try %_ execute-keys -draft ^\h*[})\]]+ \; gh / [})\]] m 1 _ > From 21bf092230d6d5766a8eb7f10be5b6616a8c3128 Mon Sep 17 00:00:00 2001 From: John Isom Date: Wed, 29 Jul 2020 09:31:20 -0600 Subject: [PATCH 62/87] Update deindenting in dart.kak --- rc/filetype/dart.kak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rc/filetype/dart.kak b/rc/filetype/dart.kak index 70e4fcb7..6cc246d8 100644 --- a/rc/filetype/dart.kak +++ b/rc/filetype/dart.kak @@ -98,7 +98,7 @@ define-command -hidden dart-indent-on-new-line %~ # indent after if|else|while|for try %[ execute-keys -draft )MB \A(if|else|while|for)\h*\(.*\)\h*\n\h*\n?\z s \A|.\z 11 ] # deindent closing brace when after cursor - try %[ execute-keys -draft ^\h*\}\h*\;?\h*(?://.*)?$ \; \} m 1 ] + try %[ execute-keys -draft ^\h*\} \; gh / \} m 1 ] = ~ From 4a77566ee684f81bd59985521ec9c3eebe5ae989 Mon Sep 17 00:00:00 2001 From: John Isom Date: Wed, 29 Jul 2020 09:32:43 -0600 Subject: [PATCH 63/87] Update deindenting in cabal.kak --- rc/filetype/cabal.kak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rc/filetype/cabal.kak b/rc/filetype/cabal.kak index d721b1c6..2557ba00 100644 --- a/rc/filetype/cabal.kak +++ b/rc/filetype/cabal.kak @@ -61,7 +61,7 @@ define-command -hidden cabal-indent-on-new-line %[ # indent after lines ending with { or : try %[ execute-keys -draft k [:{]$ j ] # deindent closing brace when after cursor - try %[ execute-keys -draft \h*\}\h*(?:--.*)?$ \; \} m 1 ] + try %[ execute-keys -draft \h*\} / \} m 1 ] ] ] From 528feb3422913400dbd20da25fb362bf594a282f Mon Sep 17 00:00:00 2001 From: John Isom Date: Wed, 29 Jul 2020 09:34:29 -0600 Subject: [PATCH 64/87] Update deindenting in dart.kak and javascript.kak --- rc/filetype/dart.kak | 2 +- rc/filetype/javascript.kak | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rc/filetype/dart.kak b/rc/filetype/dart.kak index 6cc246d8..2a07eafc 100644 --- a/rc/filetype/dart.kak +++ b/rc/filetype/dart.kak @@ -98,7 +98,7 @@ define-command -hidden dart-indent-on-new-line %~ # indent after if|else|while|for try %[ execute-keys -draft )MB \A(if|else|while|for)\h*\(.*\)\h*\n\h*\n?\z s \A|.\z 11 ] # deindent closing brace when after cursor - try %[ execute-keys -draft ^\h*\} \; gh / \} m 1 ] + try %[ execute-keys -draft ^\h*\} gh / \} m 1 ] = ~ diff --git a/rc/filetype/javascript.kak b/rc/filetype/javascript.kak index a3bc0654..c7feb46b 100644 --- a/rc/filetype/javascript.kak +++ b/rc/filetype/javascript.kak @@ -63,7 +63,7 @@ define-command -hidden javascript-indent-on-new-line %< # indent after lines beginning / ending with opener token try %_ execute-keys -draft k ^\h*[[({]|[[({]$ j _ # deindent closing token(s) when after cursor - try %_ execute-keys -draft ^\h*[})\]]+ \; gh / [})\]] m 1 _ + try %_ execute-keys -draft ^\h*[})\]] gh / [})\]] m 1 _ > > From bad751197a62bbef8cd2bd286adfbf40a8c2f4a8 Mon Sep 17 00:00:00 2001 From: John Isom Date: Wed, 29 Jul 2020 09:35:36 -0600 Subject: [PATCH 65/87] Update deindenting in css.kak --- rc/filetype/css.kak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rc/filetype/css.kak b/rc/filetype/css.kak index 4522effb..7f6f7866 100644 --- a/rc/filetype/css.kak +++ b/rc/filetype/css.kak @@ -72,7 +72,7 @@ define-command -hidden css-indent-on-new-line %[ # indent after lines ending with with { try %[ execute-keys -draft k \{$ j ] # deindent closing brace when after cursor - try %[ execute-keys -draft ^\h*\}\h*$ \} m 1 ] + try %[ execute-keys -draft ^\h*\} gh / \} m 1 ] ] ] From 9d4e33c775c160d7965a7aab89a2bc043c2a5b72 Mon Sep 17 00:00:00 2001 From: John Isom Date: Wed, 29 Jul 2020 09:40:58 -0600 Subject: [PATCH 66/87] Clean up my previous updates --- rc/filetype/d.kak | 2 +- rc/filetype/json.kak | 2 +- rc/filetype/kakrc.kak | 4 ++-- rc/filetype/latex.kak | 2 +- rc/filetype/perl.kak | 2 +- rc/filetype/php.kak | 2 +- rc/filetype/rust.kak | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/rc/filetype/d.kak b/rc/filetype/d.kak index 8bf40e26..73db7e52 100644 --- a/rc/filetype/d.kak +++ b/rc/filetype/d.kak @@ -122,7 +122,7 @@ define-command -hidden d-indent-on-new-line %~ # indent after if|else|while|for try %[ execute-keys -draft )MB \A(if|else|while|for)\h*\(.*\)\h*\n\h*\n?\z s \A|.\z 11 ] # deindent closing brace(s) when after cursor - try %[ execute-keys -draft ^\h*[})]+\h*\;?\h*(?://.*)?$ \; [})] m 1 ] + try %[ execute-keys -draft ^\h*[})] gh / [})] m 1 ] = ~ diff --git a/rc/filetype/json.kak b/rc/filetype/json.kak index 76b4e861..67f0506c 100644 --- a/rc/filetype/json.kak +++ b/rc/filetype/json.kak @@ -62,7 +62,7 @@ define-command -hidden json-indent-on-new-line %< # indent after lines ending with opener token try %< execute-keys -draft k [[{]\h*$ j > # deindent closer token(s) when after cursor - try %< execute-keys -draft ^\h*[}\]]+ \; gh / [}\]] m 1 > + try %< execute-keys -draft ^\h*[}\]] gh / [}\]] m 1 > > > diff --git a/rc/filetype/kakrc.kak b/rc/filetype/kakrc.kak index 4bf2966e..bf59cdbf 100644 --- a/rc/filetype/kakrc.kak +++ b/rc/filetype/kakrc.kak @@ -101,9 +101,9 @@ define-command -hidden kak-indent-on-new-line %~ # indent after line ending with %\w*[^\s\w] try %{ execute-keys -draft k \%\w*[^\s\w]$ j } # deindent closing brace when after cursor - try %_ execute-keys -draft -itersel ^\h*([>)}\]])\h*(?:\h#.*)?$ 1 m 1 _ + try %_ execute-keys -draft -itersel ^\h*([>)}\]]) gh / 1 m 1 _ # deindent closing char(s) - try %{ execute-keys -draft -itersel ^\h*([^\s\w])\h*(?:\h#.*)?$ 1 1 % \w*1$ 1 } + try %{ execute-keys -draft -itersel ^\h*([^\s\w]) gh / 1 1 % \w*1$ 1 } = ~ diff --git a/rc/filetype/latex.kak b/rc/filetype/latex.kak index 38bf7882..a872ad14 100644 --- a/rc/filetype/latex.kak +++ b/rc/filetype/latex.kak @@ -69,7 +69,7 @@ define-command -hidden latex-indent-newline %( # indent after line ending with { try %( execute-keys -draft k \{$ j ) # deindent closing brace(s) when after cursor - try %( execute-keys -draft ^\h*\}+\h*(?:%.*)?$ \} m 1 ) + try %( execute-keys -draft ^\h*\} gh / \} m 1 ) # indent after line ending with \begin{...}[...]{...}, with multiple # sets of arguments possible try %( diff --git a/rc/filetype/perl.kak b/rc/filetype/perl.kak index 9fa14bb8..348b4cd3 100644 --- a/rc/filetype/perl.kak +++ b/rc/filetype/perl.kak @@ -118,7 +118,7 @@ define-command -hidden perl-indent-on-new-line %~ # indent after if|else|while|for try %[ execute-keys -draft )MB \A(if|else|while|for)\h*\(.*\)\h*\n\h*\n?\z s \A|.\z 11 ] # deindent closing brace(s) when after cursor - try %[ execute-keys -draft ^\h*[})]+\h*(?:#.*)?$ \; [})] m 1 ] + try %[ execute-keys -draft ^\h*[})] gh / [})] m 1 ] = ~ diff --git a/rc/filetype/php.kak b/rc/filetype/php.kak index 075b0eb8..770a4b60 100644 --- a/rc/filetype/php.kak +++ b/rc/filetype/php.kak @@ -94,7 +94,7 @@ define-command -hidden php-indent-on-new-line %< # append " * " on lines starting a multiline /** or /* comment try %{ execute-keys -draft k s ^\h*/[*][* ]? j gi i * } # deindent closer token(s) when after cursor - try %_ execute-keys -draft ^\h*[})]+\h*(?://.*)?$ \; [})] m 1 _ + try %_ execute-keys -draft ^\h*[})] gh / [})] m 1 _ > > diff --git a/rc/filetype/rust.kak b/rc/filetype/rust.kak index 92d5cfa8..049fc444 100644 --- a/rc/filetype/rust.kak +++ b/rc/filetype/rust.kak @@ -113,7 +113,7 @@ define-command -hidden rust-indent-on-new-line %~ # dedent after lines starting with . and ending with , or ; try %_ execute-keys -draft k ^\h*\..*[,]\h*$ j _ # deindent closing brace(s) when after cursor - try %= execute-keys -draft ^\h*[})]+\h*$ \; [})] m 1 = + try %= execute-keys -draft ^\h*[})] gh / [})] m 1 = # todo dedent additional unmatched parenthesis # try %& execute-keys -draft k s \((?:[^)(]+|\((?:[^)(]+|\([^)(]*\))*\))*\) l Gl s\) %sh{ # count previous selections length From 29e94c46e0a0bc895b767a0da42ae20954f26a78 Mon Sep 17 00:00:00 2001 From: John Isom Date: Wed, 29 Jul 2020 15:04:14 -0600 Subject: [PATCH 67/87] Fix already-existing bug in javascript.kak --- rc/filetype/javascript.kak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rc/filetype/javascript.kak b/rc/filetype/javascript.kak index c7feb46b..fdac14af 100644 --- a/rc/filetype/javascript.kak +++ b/rc/filetype/javascript.kak @@ -61,7 +61,7 @@ define-command -hidden javascript-indent-on-new-line %< # filter previous line try %{ execute-keys -draft k : javascript-trim-indent } # indent after lines beginning / ending with opener token - try %_ execute-keys -draft k ^\h*[[({]|[[({]$ j _ + try %_ execute-keys -draft k s [[({] [\])}] j _ # deindent closing token(s) when after cursor try %_ execute-keys -draft ^\h*[})\]] gh / [})\]] m 1 _ > From 428232d2fa920c57b0213f0b208ea5aac3f7c11c Mon Sep 17 00:00:00 2001 From: John Isom Date: Wed, 29 Jul 2020 15:05:49 -0600 Subject: [PATCH 68/87] Add tests for javascript deindenting --- .../javascript/deindent-complex-brace-structure/cmd | 1 + .../javascript/deindent-complex-brace-structure/in | 1 + .../javascript/deindent-complex-brace-structure/out | 12 ++++++++++++ .../javascript/deindent-complex-brace-structure/rc | 3 +++ 4 files changed, 17 insertions(+) create mode 100644 test/indent/javascript/deindent-complex-brace-structure/cmd create mode 100644 test/indent/javascript/deindent-complex-brace-structure/in create mode 100644 test/indent/javascript/deindent-complex-brace-structure/out create mode 100644 test/indent/javascript/deindent-complex-brace-structure/rc diff --git a/test/indent/javascript/deindent-complex-brace-structure/cmd b/test/indent/javascript/deindent-complex-brace-structure/cmd new file mode 100644 index 00000000..f9bfe77d --- /dev/null +++ b/test/indent/javascript/deindent-complex-brace-structure/cmd @@ -0,0 +1 @@ +cOif (true) {}hiOconsole.log();hhiO{},{},hhi1Ofoo: { bar: 1 },jjobaz: { bam: 2 }, diff --git a/test/indent/javascript/deindent-complex-brace-structure/in b/test/indent/javascript/deindent-complex-brace-structure/in new file mode 100644 index 00000000..0f89c5b3 --- /dev/null +++ b/test/indent/javascript/deindent-complex-brace-structure/in @@ -0,0 +1 @@ +for (let i = 1; i < 5; ++i) {%( )} diff --git a/test/indent/javascript/deindent-complex-brace-structure/out b/test/indent/javascript/deindent-complex-brace-structure/out new file mode 100644 index 00000000..1d675934 --- /dev/null +++ b/test/indent/javascript/deindent-complex-brace-structure/out @@ -0,0 +1,12 @@ +for (let i = 1; i < 5; ++i) { + if (true) { + console.log( + { + foo: { bar: 1 }, + }, + { + baz: { bam: 2 }, + }, + ); + } +} diff --git a/test/indent/javascript/deindent-complex-brace-structure/rc b/test/indent/javascript/deindent-complex-brace-structure/rc new file mode 100644 index 00000000..c975d253 --- /dev/null +++ b/test/indent/javascript/deindent-complex-brace-structure/rc @@ -0,0 +1,3 @@ +source "%val{runtime}/colors/default.kak" +source "%val{runtime}/rc/filetype/javascript.kak" +set buffer filetype javascript From 1951f19fd8956249060a9101333da9f81e85e0d9 Mon Sep 17 00:00:00 2001 From: John Isom Date: Wed, 29 Jul 2020 15:06:27 -0600 Subject: [PATCH 69/87] Update deindentation rule for awk.kak, cabal.kak, go.kak --- rc/filetype/awk.kak | 2 +- rc/filetype/cabal.kak | 2 +- rc/filetype/go.kak | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/rc/filetype/awk.kak b/rc/filetype/awk.kak index 13f3dc64..85ec591a 100644 --- a/rc/filetype/awk.kak +++ b/rc/filetype/awk.kak @@ -77,7 +77,7 @@ define-command -hidden awk-indent-on-new-line %[ # indent after line ending in opening curly brace try %[ execute-keys -draft k \{\h*(#.*)?$ j ] # deindent closing brace when after cursor - try %[ execute-keys -draft ^\h*\}\h*(?:#.*)?$ hm 1 ] + try %[ execute-keys -draft ^\h*\} gh / \} m 1 ] ] ] diff --git a/rc/filetype/cabal.kak b/rc/filetype/cabal.kak index 2557ba00..cb95d2d9 100644 --- a/rc/filetype/cabal.kak +++ b/rc/filetype/cabal.kak @@ -61,7 +61,7 @@ define-command -hidden cabal-indent-on-new-line %[ # indent after lines ending with { or : try %[ execute-keys -draft k [:{]$ j ] # deindent closing brace when after cursor - try %[ execute-keys -draft \h*\} / \} m 1 ] + try %[ execute-keys -draft \h*\} gh / \} m 1 ] ] ] diff --git a/rc/filetype/go.kak b/rc/filetype/go.kak index 8899a8c1..5d077991 100644 --- a/rc/filetype/go.kak +++ b/rc/filetype/go.kak @@ -90,7 +90,7 @@ define-command -hidden go-indent-on-new-line %~ # indent after if|else|while|for try %[ execute-keys -draft )MB \A(if|else|while|for)\h*\(.*\)\h*\n\h*\n?\z s \A|.\z 11 ] # deindent closing brace(s) when after cursor - try %[ execute-keys -draft ^\h*[})]+\h*$ hm 1 ] + try %[ execute-keys -draft ^\h*[})] gh / [})] m 1 ] = ~ From 9560ef3dd5884bb19c9c3e0a8c7873f570b25594 Mon Sep 17 00:00:00 2001 From: John Isom Date: Wed, 29 Jul 2020 15:13:36 -0600 Subject: [PATCH 70/87] Update deindentation in gluon.kak --- rc/filetype/gluon.kak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rc/filetype/gluon.kak b/rc/filetype/gluon.kak index 1e62dc99..d8ed662d 100644 --- a/rc/filetype/gluon.kak +++ b/rc/filetype/gluon.kak @@ -90,7 +90,7 @@ define-command -hidden gluon-indent-on-new-line %{ # or in try %{ execute-keys -draft \; k x (\(|\{|\[|=|->|then|else|rec|in)$ j } # deindent closing brace(s) when after cursor - try %{ execute-keys -draft ^\h*[})\]]+\h*$ hm 1 } + try %{ execute-keys -draft ^\h*[})\]] gh / [})\]] m 1 } } } From 9c957167fadb470a91a8b9405376c73fbfa07f2d Mon Sep 17 00:00:00 2001 From: John Isom Date: Wed, 29 Jul 2020 15:14:35 -0600 Subject: [PATCH 71/87] Update deindentation in c-family.kak --- rc/filetype/c-family.kak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rc/filetype/c-family.kak b/rc/filetype/c-family.kak index 5817e4b3..aaa99e10 100644 --- a/rc/filetype/c-family.kak +++ b/rc/filetype/c-family.kak @@ -99,7 +99,7 @@ define-command -hidden c-family-indent-on-newline %< evaluate-commands -draft -i K s \belse\b\h*(?://[^\n]+)?\n([^\n]*\n){2}\z \ 1 > # deindent closing brace(s) when after cursor - try %< execute-keys -draft ^\h*[})]+\h*$ hm 1 > + try %< execute-keys -draft ^\h*[})] gh / [})] m 1 > # align to the opening parenthesis or opening brace (whichever is first) # on a previous line if its followed by text on the same line try %< evaluate-commands -draft %< From e43981422e7068d3aa6e8a3d81e09e37a8fe2bc3 Mon Sep 17 00:00:00 2001 From: John Isom Date: Wed, 29 Jul 2020 17:02:50 -0600 Subject: [PATCH 72/87] Update deindentation in java.kak --- rc/filetype/java.kak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rc/filetype/java.kak b/rc/filetype/java.kak index a2b18fd1..12cb99a3 100644 --- a/rc/filetype/java.kak +++ b/rc/filetype/java.kak @@ -57,7 +57,7 @@ define-command -hidden java-indent-on-new-line %~ # indent after keywords try %[ execute-keys -draft )MB \A(if|else|while|for|try|catch)\h*\(.*\)\h*\n\h*\n?\z s \A|.\z 11 ] # deindent closing brace(s) when after cursor - try %[ execute-keys -draft ^\h*[})]+\h*$ hm 1 ] + try %[ execute-keys -draft ^\h*[})] gh / [})] m 1 ] = ~ From 5284196cb36af44c63a8f6d561768c86ce18c84e Mon Sep 17 00:00:00 2001 From: John Isom Date: Wed, 29 Jul 2020 17:02:54 -0600 Subject: [PATCH 73/87] Update deindentation in cue.kak --- rc/filetype/cue.kak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rc/filetype/cue.kak b/rc/filetype/cue.kak index 85a9f318..ab46059e 100644 --- a/rc/filetype/cue.kak +++ b/rc/filetype/cue.kak @@ -137,7 +137,7 @@ define-command -hidden cue-indent-on-new-line %~ # indent after lines ending with [{(].+ and move first parameter to own line try %< execute-keys -draft [c[({],[)}] \A[({][^\n]+\n[^\n]*\n?\z L i > # deindent closing brace(s) when after cursor - try %< execute-keys -draft ^\h*[})]+\h*$ hm 1 > + try %< execute-keys -draft ^\h*[})] gh / [})] m 1 > | # filter previous line try %{ execute-keys -draft k : cue-trim-indent } From 7f4e48e3da5c84e9341361a6612eb049f64230bc Mon Sep 17 00:00:00 2001 From: John Isom Date: Wed, 29 Jul 2020 17:04:01 -0600 Subject: [PATCH 74/87] Update deindentation in nix.kak --- rc/filetype/nix.kak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rc/filetype/nix.kak b/rc/filetype/nix.kak index 9fc4dc66..091204e9 100644 --- a/rc/filetype/nix.kak +++ b/rc/filetype/nix.kak @@ -110,7 +110,7 @@ define-command -hidden nix-indent-on-new-line %< # indent after lines beginning / ending with opener token try %_ execute-keys -draft k ^\h*[[{]|[[{]$ j _ # deindent closer token(s) when after cursor - try %_ execute-keys -draft ^\h*[}\]]+\h*$ hm 1 _ + try %_ execute-keys -draft ^\h*[}\]] gh / [}\]] m 1 _ > > From 858b0dd1c921671d7d6b9f1d846ea30bb4d3e61d Mon Sep 17 00:00:00 2001 From: John Isom Date: Wed, 29 Jul 2020 17:04:01 -0600 Subject: [PATCH 75/87] Update deindentation in nix.kak --- rc/filetype/nix.kak | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rc/filetype/nix.kak b/rc/filetype/nix.kak index 9fc4dc66..091204e9 100644 --- a/rc/filetype/nix.kak +++ b/rc/filetype/nix.kak @@ -110,7 +110,7 @@ define-command -hidden nix-indent-on-new-line %< # indent after lines beginning / ending with opener token try %_ execute-keys -draft k ^\h*[[{]|[[{]$ j _ # deindent closer token(s) when after cursor - try %_ execute-keys -draft ^\h*[}\]]+\h*$ hm 1 _ + try %_ execute-keys -draft ^\h*[}\]] gh / [}\]] m 1 _ > > From 14514422dbafb5b7e75747e714588433c637c5a8 Mon Sep 17 00:00:00 2001 From: John Isom Date: Wed, 29 Jul 2020 20:31:20 -0600 Subject: [PATCH 76/87] Fix deindentation in ragel.kak --- rc/filetype/ragel.kak | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rc/filetype/ragel.kak b/rc/filetype/ragel.kak index 85a79b31..ff499992 100644 --- a/rc/filetype/ragel.kak +++ b/rc/filetype/ragel.kak @@ -70,6 +70,8 @@ define-command -hidden ragel-indent-on-new-line %< try %{ execute-keys -draft k : ragel-trim-indent } # indent after lines ending with opener token try %< execute-keys -draft k [[{(*]$ j > + # align closer token to its opener when after cursor + try %< execute-keys -draft ^\h*[})\]] gh / [})\]] m 1 > > > From 53188e66c724da3a19629549f0091a9642b9b0a0 Mon Sep 17 00:00:00 2001 From: John Isom Date: Wed, 29 Jul 2020 20:31:34 -0600 Subject: [PATCH 77/87] Fix deindentation in python.kak --- rc/filetype/python.kak | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rc/filetype/python.kak b/rc/filetype/python.kak index bac31e3f..08b079c9 100644 --- a/rc/filetype/python.kak +++ b/rc/filetype/python.kak @@ -157,6 +157,8 @@ define-command -hidden python-indent-on-new-line %{ try %{ execute-keys -draft k s \h+$ d } # indent after line ending with : try %{ execute-keys -draft k :$ j } + # deindent closing brace/bracket when after cursor (for arrays and dictionaries) + try %[ execute-keys -draft ^\h*[}\]] gh / [}\]] m 1 ] } } From 70d1aa114b599300356378eb931b7f4824268382 Mon Sep 17 00:00:00 2001 From: John Isom Date: Wed, 29 Jul 2020 20:31:43 -0600 Subject: [PATCH 78/87] Fix deindentation in protobuf.kak --- rc/filetype/protobuf.kak | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rc/filetype/protobuf.kak b/rc/filetype/protobuf.kak index 2e7d8f97..3d9c9fba 100644 --- a/rc/filetype/protobuf.kak +++ b/rc/filetype/protobuf.kak @@ -76,6 +76,8 @@ define-command -hidden protobuf-indent-on-newline %~ try %{ execute-keys -draft k s \h+$ d } # copy // comments prefix try %{ execute-keys -draft k s ^\h*\K/{2,}(\h*(?=\S))? yP } + # deindent closing brace(s) when after cursor + try %[ execute-keys -draft ^\h*\} gh / \} m 1 ] ] ~ From cf7eab62bda60c5b933e149b2ce81c89db538023 Mon Sep 17 00:00:00 2001 From: John Isom Date: Wed, 29 Jul 2020 20:31:58 -0600 Subject: [PATCH 79/87] Fix already-existing error in ragel.kak --- rc/filetype/ragel.kak | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rc/filetype/ragel.kak b/rc/filetype/ragel.kak index ff499992..eadcf1f7 100644 --- a/rc/filetype/ragel.kak +++ b/rc/filetype/ragel.kak @@ -55,8 +55,8 @@ define-command -hidden ragel-trim-indent %{ define-command -hidden ragel-indent-on-char %< evaluate-commands -draft -itersel %< # align closer token to its opener when alone on a line - try %< execute-keys -draft ^\h+[]})]$ m s \A|.\z 1 > - try %< execute-keys -draft ^\h+ [*]$ [*]$ s \A|.\z 1 > + try %< execute-keys -draft ^\h+[\]})]$ m s \A|.\z 1 > + try %< execute-keys -draft ^\h+ [*]$ [*]$ s \A|.\z 1 > > > From d77fe33e9ada1995c9e646ae0eb396bccbbcb6d7 Mon Sep 17 00:00:00 2001 From: John Isom Date: Wed, 29 Jul 2020 20:45:54 -0600 Subject: [PATCH 80/87] Fix my issues in python.kak --- rc/filetype/python.kak | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/rc/filetype/python.kak b/rc/filetype/python.kak index 08b079c9..db62c8db 100644 --- a/rc/filetype/python.kak +++ b/rc/filetype/python.kak @@ -28,7 +28,7 @@ hook -group python-highlight global WinSetOption filetype=python %{ hook -once -always window WinSetOption filetype=.* %{ remove-highlighter window/python } } -provide-module python %{ +provide-module python %§ # Highlighters & Completion # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ @@ -149,8 +149,8 @@ define-command -hidden python-insert-on-new-line %{ try %{ execute-keys -draft k s ^\h*#\h* y jgh P } } } -define-command -hidden python-indent-on-new-line %{ - evaluate-commands -draft -itersel %{ +define-command -hidden python-indent-on-new-line %< + evaluate-commands -draft -itersel %< # preserve previous line indent try %{ execute-keys -draft K } # cleanup trailing whitespaces from previous line @@ -159,7 +159,7 @@ define-command -hidden python-indent-on-new-line %{ try %{ execute-keys -draft k :$ j } # deindent closing brace/bracket when after cursor (for arrays and dictionaries) try %[ execute-keys -draft ^\h*[}\]] gh / [}\]] m 1 ] - } -} + > +> -} +§ From e02a3711fa7ed6471b95d4da0fd63981edb86c4e Mon Sep 17 00:00:00 2001 From: John Isom Date: Wed, 29 Jul 2020 21:07:43 -0600 Subject: [PATCH 81/87] Fix my issues in gluon.kak --- rc/filetype/gluon.kak | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/rc/filetype/gluon.kak b/rc/filetype/gluon.kak index d8ed662d..10a2cc2f 100644 --- a/rc/filetype/gluon.kak +++ b/rc/filetype/gluon.kak @@ -31,7 +31,7 @@ hook -group gluon-highlight global WinSetOption filetype=gluon %{ } -provide-module gluon %[ +provide-module gluon %§ # Highlighters # ‾‾‾‾‾‾‾‾‾‾‾‾ @@ -78,8 +78,8 @@ define-command -hidden gluon-trim-indent %{ try %{ execute-keys -draft -itersel s \h+$ d } } -define-command -hidden gluon-indent-on-new-line %{ - evaluate-commands -draft -itersel %{ +define-command -hidden gluon-indent-on-new-line %< + evaluate-commands -draft -itersel %< # copy // and /// comments prefix and following white spaces try %{ execute-keys -draft k s ^\h*\K///?\h* y gh j P } # preserve previous line indent @@ -91,7 +91,7 @@ define-command -hidden gluon-indent-on-new-line %{ try %{ execute-keys -draft \; k x (\(|\{|\[|=|->|then|else|rec|in)$ j } # deindent closing brace(s) when after cursor try %{ execute-keys -draft ^\h*[})\]] gh / [})\]] m 1 } - } -} + > +> -] +§ From 6c02f80935a2fc2004630c73efe50de90f9b21b8 Mon Sep 17 00:00:00 2001 From: John Isom Date: Wed, 29 Jul 2020 21:10:43 -0600 Subject: [PATCH 82/87] Add indent-on-closing-brace rule to sass.kak --- rc/filetype/sass.kak | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/rc/filetype/sass.kak b/rc/filetype/sass.kak index 403a47dd..aafe7eb1 100644 --- a/rc/filetype/sass.kak +++ b/rc/filetype/sass.kak @@ -11,15 +11,16 @@ hook global BufCreate .*[.](sass) %{ # Initialization # ‾‾‾‾‾‾‾‾‾‾‾‾‾‾ -hook global WinSetOption filetype=sass %{ +hook global WinSetOption filetype=sass %< require-module sass hook window ModeChange pop:insert:.* -group sass-trim-indent sass-trim-indent + hook window InsertChar \} -group sass-indent sass-indent-on-closing-brace hook window InsertChar \n -group sass-indent sass-indent-on-new-line set-option buffer extra_word_chars '_' '-' hook -once -always window WinSetOption filetype=.* %{ remove-hooks window sass-.+ } -} +> hook -group sass-highlight global WinSetOption filetype=sass %{ add-highlighter window/sass ref sass @@ -27,7 +28,7 @@ hook -group sass-highlight global WinSetOption filetype=sass %{ } -provide-module sass %{ +provide-module sass %§ # Highlighters # ‾‾‾‾‾‾‾‾‾‾‾‾ @@ -53,6 +54,13 @@ define-command -hidden sass-trim-indent %{ try %{ execute-keys -draft -itersel s \h+$ d } } +define-command -hidden sass-indent-on-closing-brace %< + evaluate-commands -draft -itersel %< + # align closing brace to same indentation as the line that the opening brace resides on + try %[ execute-keys -draft ^\h+\}$ m 1 ] + > +> + define-command -hidden sass-indent-on-new-line %{ evaluate-commands -draft -itersel %{ # copy '/' comment prefix and following white spaces @@ -66,4 +74,4 @@ define-command -hidden sass-indent-on-new-line %{ } } -} +§ From cc30131e16f44b14d288febd8e13308e8e88e64c Mon Sep 17 00:00:00 2001 From: John Isom Date: Wed, 29 Jul 2020 21:17:58 -0600 Subject: [PATCH 83/87] Fix my issues in gluon.kak --- rc/filetype/gluon.kak | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/rc/filetype/gluon.kak b/rc/filetype/gluon.kak index 10a2cc2f..d2e23644 100644 --- a/rc/filetype/gluon.kak +++ b/rc/filetype/gluon.kak @@ -78,8 +78,8 @@ define-command -hidden gluon-trim-indent %{ try %{ execute-keys -draft -itersel s \h+$ d } } -define-command -hidden gluon-indent-on-new-line %< - evaluate-commands -draft -itersel %< +define-command -hidden gluon-indent-on-new-line %~ + evaluate-commands -draft -itersel %_ # copy // and /// comments prefix and following white spaces try %{ execute-keys -draft k s ^\h*\K///?\h* y gh j P } # preserve previous line indent @@ -90,8 +90,8 @@ define-command -hidden gluon-indent-on-new-line %< # or in try %{ execute-keys -draft \; k x (\(|\{|\[|=|->|then|else|rec|in)$ j } # deindent closing brace(s) when after cursor - try %{ execute-keys -draft ^\h*[})\]] gh / [})\]] m 1 } - > -> + try %< execute-keys -draft ^\h*[})\]] gh / \})\]] m 1 > + _ +~ § From d5fe3a2b12f0f6a1bb87449c45db323eb2c43796 Mon Sep 17 00:00:00 2001 From: John Isom Date: Wed, 29 Jul 2020 21:22:38 -0600 Subject: [PATCH 84/87] Fix deindentation in sass.kak --- rc/filetype/sass.kak | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/rc/filetype/sass.kak b/rc/filetype/sass.kak index aafe7eb1..d3df6300 100644 --- a/rc/filetype/sass.kak +++ b/rc/filetype/sass.kak @@ -61,8 +61,8 @@ define-command -hidden sass-indent-on-closing-brace %< > > -define-command -hidden sass-indent-on-new-line %{ - evaluate-commands -draft -itersel %{ +define-command -hidden sass-indent-on-new-line %< + evaluate-commands -draft -itersel %< # copy '/' comment prefix and following white spaces try %{ execute-keys -draft k s ^\h*\K/\h* y gh j P } # preserve previous line indent @@ -71,7 +71,9 @@ define-command -hidden sass-indent-on-new-line %{ try %{ execute-keys -draft k : sass-trim-indent } # avoid indent after properties and comments try %{ execute-keys -draft k [:/] j } - } -} + # deindent closing brace when after cursor + try %[ execute-keys -draft ^\h*\} gh / \} m 1 ] + > +> § From 085fcc2088d0eec5575b68cf886e5c2f982e37f7 Mon Sep 17 00:00:00 2001 From: John Isom Date: Wed, 29 Jul 2020 21:25:55 -0600 Subject: [PATCH 85/87] Fix deindentation in scala.kak --- rc/filetype/scala.kak | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rc/filetype/scala.kak b/rc/filetype/scala.kak index 29884d20..48dfa937 100644 --- a/rc/filetype/scala.kak +++ b/rc/filetype/scala.kak @@ -69,6 +69,8 @@ define-command -hidden scala-indent-on-new-line %[ try %[ execute-keys -draft k : scala-trim-indent ] # indent after lines ending with { try %[ execute-keys -draft k \{$ j ] + # deindent closing brace when after cursor + try %[ execute-keys -draft ^\h*\} gh / \} m 1 ] ] ] From 4a49868f2ce158f181a1eafd4aca460e64a56089 Mon Sep 17 00:00:00 2001 From: John Isom Date: Wed, 29 Jul 2020 21:31:21 -0600 Subject: [PATCH 86/87] Fix deindentation in sh.kak --- rc/filetype/sh.kak | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rc/filetype/sh.kak b/rc/filetype/sh.kak index 35076d9c..a3212760 100644 --- a/rc/filetype/sh.kak +++ b/rc/filetype/sh.kak @@ -182,6 +182,8 @@ define-command -hidden sh-indent-on-new-line %[ try %= execute-keys -draft k (\s|^)\{$ j = # deindent closing } try %= execute-keys -draft k ^\s*\}$ j K = + # deindent closing } when after cursor + try %= execute-keys -draft ^\h*\} gh / \} m 1 = ] ] From 6258646f412159259b98d80f22b80be54f63dcca Mon Sep 17 00:00:00 2001 From: John Isom Date: Wed, 29 Jul 2020 21:46:51 -0600 Subject: [PATCH 87/87] Fix deindentation in zig.kak --- rc/filetype/zig.kak | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rc/filetype/zig.kak b/rc/filetype/zig.kak index 2f0e5d55..c70a14c9 100644 --- a/rc/filetype/zig.kak +++ b/rc/filetype/zig.kak @@ -121,6 +121,8 @@ define-command -hidden zig-indent-on-new-line %< try %< execute-keys -draft K > # indent after lines ending in { try %< execute-keys -draft k \{\h*$ j > + # deindent closing } when after cursor + try %< execute-keys -draft ^\h*\} gh / \} m 1 > > # filter previous line try %< execute-keys -draft k : zig-trim-indent >