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 <ret>, this would happen: ``` json { "foo": { | } ``` when it should have been this: ``` json { "foo": { | } ```
This commit is contained in:
parent
9dd292d100
commit
01712e7f3c
|
@ -59,8 +59,8 @@ define-command -hidden json-indent-on-new-line %<
|
||||||
try %{ execute-keys -draft <semicolon> K <a-&> }
|
try %{ execute-keys -draft <semicolon> K <a-&> }
|
||||||
# filter previous line
|
# filter previous line
|
||||||
try %{ execute-keys -draft k : json-trim-indent <ret> }
|
try %{ execute-keys -draft k : json-trim-indent <ret> }
|
||||||
# indent after lines beginning with opener token
|
# indent after lines ending with opener token
|
||||||
try %< execute-keys -draft k <a-x> <a-k> ^\h*[[{] <ret> j <a-gt> >
|
try %< execute-keys -draft k <a-x> <a-k> [[{]\h*$ <ret> j <a-gt> >
|
||||||
# deindent opener token(s) when after cursor
|
# deindent opener token(s) when after cursor
|
||||||
try %< execute-keys -draft <a-x> <a-k>^\h*[}\]]+\h*$<ret> hm <a-S> 1<a-&> >
|
try %< execute-keys -draft <a-x> <a-k>^\h*[}\]]+\h*$<ret> hm <a-S> 1<a-&> >
|
||||||
>
|
>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user