Improve C indentation support around namespace/struct closing bracket
This commit is contained in:
parent
ca225ad4dc
commit
d8f00198f3
|
@ -68,12 +68,12 @@ def -hidden _c-family-indent-on-opening-curly-brace %[
|
|||
|
||||
def -hidden _c-family-indent-on-closing-curly-brace %[
|
||||
# align to opening curly brace when alone on a line
|
||||
try %[ exec -itersel -draft <a-h><a-k>^\h+\}$<ret>hms\`|.\'<ret>1<a-&> ]
|
||||
try %[ exec -itersel -draft <a-h><a-:><a-k>^\h+\}$<ret>hms\`|.\'<ret>1<a-&> ]
|
||||
]
|
||||
|
||||
def -hidden _c-family-insert-on-closing-curly-brace %[
|
||||
# add a semicolon after a closing brace if part of a class, union or struct definition
|
||||
try %[ exec -itersel -draft hm<a-x>B<a-x><a-k>^\h*(class|struct|union)<ret> a\;<esc> ]
|
||||
try %[ exec -itersel -draft hm<a-x>B<a-x><a-k>\`\h*(class|struct|union)<ret> a\;<esc> ]
|
||||
]
|
||||
|
||||
def -hidden _c-family-insert-on-newline %[ eval -draft %[
|
||||
|
|
1
test/indent/c-family/close-namespace/cmd
Normal file
1
test/indent/c-family/close-namespace/cmd
Normal file
|
@ -0,0 +1 @@
|
|||
a<ret>}<esc>
|
3
test/indent/c-family/close-namespace/in
Normal file
3
test/indent/c-family/close-namespace/in
Normal file
|
@ -0,0 +1,3 @@
|
|||
namespace A
|
||||
{
|
||||
struct B%(;)
|
4
test/indent/c-family/close-namespace/out
Normal file
4
test/indent/c-family/close-namespace/out
Normal file
|
@ -0,0 +1,4 @@
|
|||
namespace A
|
||||
{
|
||||
struct B;
|
||||
}
|
3
test/indent/c-family/close-namespace/rc
Normal file
3
test/indent/c-family/close-namespace/rc
Normal file
|
@ -0,0 +1,3 @@
|
|||
source "%val{runtime}/colors/default.kak"
|
||||
source "%val{runtime}/rc/core/c-family.kak"
|
||||
set buffer filetype cpp
|
1
test/indent/c-family/close-struct/cmd
Normal file
1
test/indent/c-family/close-struct/cmd
Normal file
|
@ -0,0 +1 @@
|
|||
a<ret>}<esc>
|
3
test/indent/c-family/close-struct/in
Normal file
3
test/indent/c-family/close-struct/in
Normal file
|
@ -0,0 +1,3 @@
|
|||
struct A
|
||||
{
|
||||
int i%(;)
|
4
test/indent/c-family/close-struct/out
Normal file
4
test/indent/c-family/close-struct/out
Normal file
|
@ -0,0 +1,4 @@
|
|||
struct A
|
||||
{
|
||||
int i;
|
||||
};
|
3
test/indent/c-family/close-struct/rc
Normal file
3
test/indent/c-family/close-struct/rc
Normal file
|
@ -0,0 +1,3 @@
|
|||
source "%val{runtime}/colors/default.kak"
|
||||
source "%val{runtime}/rc/core/c-family.kak"
|
||||
set buffer filetype cpp
|
Loading…
Reference in New Issue
Block a user