Rust dedent { after where clause
This commit is contained in:
parent
b1beea8638
commit
12cafe3ed4
|
@ -102,6 +102,8 @@ define-command -hidden rust-indent-on-opening-curly-brace %[
|
||||||
evaluate-commands -draft -itersel %_
|
evaluate-commands -draft -itersel %_
|
||||||
# align indent with opening paren when { is entered on a new line after the closing paren
|
# align indent with opening paren when { is entered on a new line after the closing paren
|
||||||
try %[ execute-keys -draft h <a-F> ) M <a-k> \A\(.*\)\h*\n\h*\{\z <ret> s \A|.\z <ret> 1<a-&> ]
|
try %[ execute-keys -draft h <a-F> ) M <a-k> \A\(.*\)\h*\n\h*\{\z <ret> s \A|.\z <ret> 1<a-&> ]
|
||||||
|
# dedent standalone { after impl or fn block without any { in between
|
||||||
|
try %< execute-keys -draft hh <a-?> impl|fn|struct|enum|union <ret> <a-K> \{ <ret> <a-semicolon> <semicolon> ll <a-x> <a-k> ^\h*\{$ <ret> <a-lt> >
|
||||||
_
|
_
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
1
test/indent/rust/on-open-paren/cmd
Normal file
1
test/indent/rust/on-open-paren/cmd
Normal file
|
@ -0,0 +1 @@
|
||||||
|
c{<esc>
|
35
test/indent/rust/on-open-paren/in
Normal file
35
test/indent/rust/on-open-paren/in
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
fn foo<T>(x: T)
|
||||||
|
where
|
||||||
|
T: Debug
|
||||||
|
%( )
|
||||||
|
|
||||||
|
fn foo<T>(x: T) where T: Debug %( )
|
||||||
|
|
||||||
|
impl<T> X for T
|
||||||
|
where
|
||||||
|
T: Debug
|
||||||
|
%( )
|
||||||
|
|
||||||
|
impl<T> X for T where T: Debug %( )
|
||||||
|
|
||||||
|
struct X<T>
|
||||||
|
where
|
||||||
|
T: Debug
|
||||||
|
%( )
|
||||||
|
|
||||||
|
struct X<T> where T: Debug %( )
|
||||||
|
|
||||||
|
enum X<T>
|
||||||
|
where
|
||||||
|
T: Debug
|
||||||
|
%( )
|
||||||
|
|
||||||
|
enum X<T> where T: Debug %( )
|
||||||
|
|
||||||
|
union X<T>
|
||||||
|
where
|
||||||
|
T: Debug
|
||||||
|
%( )
|
||||||
|
|
||||||
|
union X<T> where T: Debug %( )
|
||||||
|
|
35
test/indent/rust/on-open-paren/out
Normal file
35
test/indent/rust/on-open-paren/out
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
fn foo<T>(x: T)
|
||||||
|
where
|
||||||
|
T: Debug
|
||||||
|
{
|
||||||
|
|
||||||
|
fn foo<T>(x: T) where T: Debug {
|
||||||
|
|
||||||
|
impl<T> X for T
|
||||||
|
where
|
||||||
|
T: Debug
|
||||||
|
{
|
||||||
|
|
||||||
|
impl<T> X for T where T: Debug {
|
||||||
|
|
||||||
|
struct X<T>
|
||||||
|
where
|
||||||
|
T: Debug
|
||||||
|
{
|
||||||
|
|
||||||
|
struct X<T> where T: Debug {
|
||||||
|
|
||||||
|
enum X<T>
|
||||||
|
where
|
||||||
|
T: Debug
|
||||||
|
{
|
||||||
|
|
||||||
|
enum X<T> where T: Debug {
|
||||||
|
|
||||||
|
union X<T>
|
||||||
|
where
|
||||||
|
T: Debug
|
||||||
|
{
|
||||||
|
|
||||||
|
union X<T> where T: Debug {
|
||||||
|
|
3
test/indent/rust/on-open-paren/rc
Normal file
3
test/indent/rust/on-open-paren/rc
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
source "%val{runtime}/colors/default.kak"
|
||||||
|
source "%val{runtime}/rc/filetype/rust.kak"
|
||||||
|
set buffer filetype rust
|
Loading…
Reference in New Issue
Block a user