Improving the behavior of <Enter> inside delimiters

I am mostly using Kakoune for C / CPP files editions. There is a behavior that I would like to improve.
Let’s | be the cursor. In this situation:

int toto(void) {|}

If I press enter, I will obtain:

int toto(void){
   |}

Which completely makes sense, however I would like to improve this behavior to obtain:

int toto(void){
   |
}

This second version is what some vim plugins in charge of braces/parenthesis and other block delimiters would do and I personally find it more intuitive.
How can I achieve this behavior in Kakoune ? If possible with every pair delimiters and not only {}

2 Likes

Not an expert, but I think you should look at c-family-insert-on-newline on rc/filetype/c-family

Additional material concerning this topic:

@CharlesGueunet Do you mind opening an issue or PR on Kakoune?

I will try to open a PR so I can start to update the C / C++ syntax files to use this behavior. I might add some other file types if I have time (not before August I think).