1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-09-20 01:08:33 +03:00

Rust dedent { after where clause

This commit is contained in:
Ivan Tham 2020-05-31 19:19:09 +08:00
parent b1beea8638
commit 12cafe3ed4
5 changed files with 76 additions and 0 deletions

View File

@ -102,6 +102,8 @@ define-command -hidden rust-indent-on-opening-curly-brace %[
evaluate-commands -draft -itersel %_
# 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-&> ]
# 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> >
_
]

View File

@ -0,0 +1 @@
c{<esc>

View 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 %( )

View 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 {

View File

@ -0,0 +1,3 @@
source "%val{runtime}/colors/default.kak"
source "%val{runtime}/rc/filetype/rust.kak"
set buffer filetype rust