diff --git a/rc/filetype/awk.kak b/rc/filetype/awk.kak index 663174b7..85ec591a 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*\} gh / \} m 1 ] ] ] diff --git a/rc/filetype/c-family.kak b/rc/filetype/c-family.kak index b4a993eb..4f056857 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) when after cursor + 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 %< diff --git a/rc/filetype/cabal.kak b/rc/filetype/cabal.kak index 77519954..cb95d2d9 100644 --- a/rc/filetype/cabal.kak +++ b/rc/filetype/cabal.kak @@ -52,14 +52,16 @@ 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 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*\} gh / \} m 1 ] ] ] diff --git a/rc/filetype/css.kak b/rc/filetype/css.kak index 8825c84e..7f6f7866 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*\} gh / \} m 1 ] ] ] diff --git a/rc/filetype/cue.kak b/rc/filetype/cue.kak index a2fbb0c7..ab46059e 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*[})] gh / [})] m 1 > | # filter previous line try %{ execute-keys -draft k : cue-trim-indent } diff --git a/rc/filetype/d.kak b/rc/filetype/d.kak index 18e547d5..73db7e52 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*[})] gh / [})] m 1 ] = ~ diff --git a/rc/filetype/dart.kak b/rc/filetype/dart.kak index 541c1e58..2a07eafc 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*\} gh / \} m 1 ] = ~ diff --git a/rc/filetype/gluon.kak b/rc/filetype/gluon.kak index 2298737c..d2e23644 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 @@ -88,12 +88,10 @@ 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*[})\]] gh / \})\]] m 1 > + _ +~ -] +§ diff --git a/rc/filetype/go.kak b/rc/filetype/go.kak index 69ce6c27..5d077991 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) when after cursor + try %[ execute-keys -draft ^\h*[})] gh / [})] m 1 ] = ~ diff --git a/rc/filetype/java.kak b/rc/filetype/java.kak index f6a77f82..12cb99a3 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*[})] gh / [})] m 1 ] = ~ diff --git a/rc/filetype/javascript.kak b/rc/filetype/javascript.kak index 191ae95d..fdac14af 100644 --- a/rc/filetype/javascript.kak +++ b/rc/filetype/javascript.kak @@ -61,7 +61,9 @@ 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 _ > > diff --git a/rc/filetype/json.kak b/rc/filetype/json.kak index 2f798b6f..67f0506c 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 > > > @@ -59,8 +59,10 @@ 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 closer token(s) when after cursor + try %< execute-keys -draft ^\h*[}\]] gh / [}\]] m 1 > > > diff --git a/rc/filetype/kakrc.kak b/rc/filetype/kakrc.kak index 2a2f505f..bf59cdbf 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,12 @@ 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*([>)}\]]) gh / 1 m 1 _ + # deindent closing char(s) + try %{ execute-keys -draft -itersel ^\h*([^\s\w]) gh / 1 1 % \w*1$ 1 } + = +~ define-command -hidden kak-indent-on-closing-matching %~ # align to opening matching brace when alone on a line diff --git a/rc/filetype/latex.kak b/rc/filetype/latex.kak index af336f68..a872ad14 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*\} gh / \} m 1 ) # indent after line ending with \begin{...}[...]{...}, with multiple # sets of arguments possible try %( diff --git a/rc/filetype/nix.kak b/rc/filetype/nix.kak index 36137552..091204e9 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 / > > @@ -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*[}\]] gh / [}\]] m 1 _ > > diff --git a/rc/filetype/perl.kak b/rc/filetype/perl.kak index a2da7cf9..348b4cd3 100644 --- a/rc/filetype/perl.kak +++ b/rc/filetype/perl.kak @@ -111,12 +111,14 @@ 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 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*[})] gh / [})] m 1 ] = ~ diff --git a/rc/filetype/php.kak b/rc/filetype/php.kak index e296b4fa..770a4b60 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 @@ -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 / > > @@ -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*[})] gh / [})] m 1 _ > > -) +§ 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 ] ] ~ diff --git a/rc/filetype/python.kak b/rc/filetype/python.kak index bac31e3f..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,15 +149,17 @@ 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 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 ] + > +> -} +§ diff --git a/rc/filetype/ragel.kak b/rc/filetype/ragel.kak index 85a79b31..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 > > > @@ -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 > > > diff --git a/rc/filetype/rust.kak b/rc/filetype/rust.kak index 24d36f88..049fc444 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) when after cursor + 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 diff --git a/rc/filetype/sass.kak b/rc/filetype/sass.kak index 403a47dd..d3df6300 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,8 +54,15 @@ define-command -hidden sass-trim-indent %{ try %{ execute-keys -draft -itersel s \h+$ d } } -define-command -hidden sass-indent-on-new-line %{ - evaluate-commands -draft -itersel %{ +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 try %{ execute-keys -draft k s ^\h*\K/\h* y gh j P } # preserve previous line indent @@ -63,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 ] + > +> -} +§ 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 ] ] ] diff --git a/rc/filetype/sh.kak b/rc/filetype/sh.kak index 05cf3016..56511903 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 = ] ] 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 > 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..732f00da --- /dev/null +++ b/test/indent/c-family/deindent-function-closing-brace/in @@ -0,0 +1,15 @@ +void foo(void) {%( )} + +void foo(void) {%( ) +} + +void foo(void) {%( )bar()} + +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..b507fbee --- /dev/null +++ b/test/indent/c-family/deindent-function-closing-brace/out @@ -0,0 +1,21 @@ +void foo(void) { +} + +void foo(void) { + +} + +void foo(void) { + bar()} + +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..d7e7a23d --- /dev/null +++ b/test/indent/c-family/deindent-generic-closing-brace/in @@ -0,0 +1,31 @@ +{%( )} + +{%( ) +} + +{%( )bar()} + +{%( )bar() +} + +{ + bar()%( )} + +{(%( ))} + +{(%( ) +)} + +{(%( )foo())} + +{(%( )foo() +)} + +{( + 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 new file mode 100644 index 00000000..d00507c9 --- /dev/null +++ b/test/indent/c-family/deindent-generic-closing-brace/out @@ -0,0 +1,43 @@ +{ +} + +{ + +} + +{ + bar()} + +{ + bar() +} + +{ + bar() +} + +{( +)} + +{( + +)} + +{( + foo())} + +{( + foo() +)} + +{( + bar() +)} + + { + bar() + } + + {( + 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..5ac38a34 --- /dev/null +++ b/test/indent/c-family/deindent-if-closing-brace/in @@ -0,0 +1,15 @@ +if (1) {%( )} + +if (1) {%( ) +} + +if (1) {%( )bar()} + +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..d46b84cf --- /dev/null +++ b/test/indent/c-family/deindent-if-closing-brace/out @@ -0,0 +1,21 @@ +if (1) { +} + +if (1) { + +} + +if (1) { + bar()} + +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 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..a30bf4c4 --- /dev/null +++ b/test/indent/go/deindent-function-closing-brace/in @@ -0,0 +1,15 @@ +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()%( )} + + 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..3a5e4869 --- /dev/null +++ b/test/indent/go/deindent-function-closing-brace/out @@ -0,0 +1,21 @@ +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() +} + + 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..5a31c18f --- /dev/null +++ b/test/indent/go/deindent-generic-closing-brace/in @@ -0,0 +1,31 @@ +{%( )} + +{%( ) +} + +{%( )bar()} + +{%( )bar() +} + +{ + bar()%( )} + + { + bar()%( )} + +{(%( ))} + +{(%( ) +)} + +{(%( )foo())} + +{(%( )foo() +)} + +{( + bar()%( ))} + + {( + 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..cfd6db40 --- /dev/null +++ b/test/indent/go/deindent-generic-closing-brace/out @@ -0,0 +1,43 @@ +{ +} + +{ + +} + +{ + bar()} + +{ + bar() +} + +{ + bar() +} + + { + bar() + } + +{( +)} + +{( + +)} + +{( + foo())} + +{( + foo() +)} + +{( + bar() +)} + + {( + 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 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 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..ab5cc032 --- /dev/null +++ b/test/indent/rust/deindent-function-closing-brace/in @@ -0,0 +1,15 @@ +fn foo() -> i32 {%( )} + +fn foo() -> i32 {%( ) +} + +fn foo() -> i32 {%( )bar()} + +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..2c58c554 --- /dev/null +++ b/test/indent/rust/deindent-function-closing-brace/out @@ -0,0 +1,21 @@ +fn foo() -> i32 { +} + +fn foo() -> i32 { + +} + +fn foo() -> i32 { + bar()} + +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..21109831 --- /dev/null +++ b/test/indent/rust/deindent-generic-closing-brace/in @@ -0,0 +1,31 @@ +{%( )} + +{%( ) +} + +{%( )bar()} + +{%( )bar() +} + +{ + bar()%( )} + + { + bar()%( )} + +{(%( ))} + +{(%( ) +)} + +{(%( )foo())} + +{(%( )foo() +)} + +{( + bar()%( ))} + + {( + 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..c8615372 --- /dev/null +++ b/test/indent/rust/deindent-generic-closing-brace/out @@ -0,0 +1,43 @@ +{ +} + +{ + +} + +{ + bar()} + +{ + bar() +} + +{ + bar() +} + + { + bar() + } + +{( +)} + +{( + +)} + +{( + foo())} + +{( + foo() +)} + +{( + bar() +)} + + {( + 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..f26c5e62 --- /dev/null +++ b/test/indent/rust/deindent-if-closing-brace/in @@ -0,0 +1,15 @@ +if true {%( )} + +if true {%( ) +} + +if true {%( )bar()} + +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..1276abbe --- /dev/null +++ b/test/indent/rust/deindent-if-closing-brace/out @@ -0,0 +1,21 @@ +if true { +} + +if true { + +} + +if true { + bar()} + +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