4coder»Forums
Pineapple
1 posts
4coder Auto close Brackets

Is it possible to make 4coder automatically close brackets, braces, parenthesis, etc. If so how would I go about do something like that?

Simon Anciaux
1266 posts
4coder Auto close Brackets

You can bind this function to your { key. And create similar functions for other keys.

CUSTOM_COMMAND_SIG( write_curly ) {
    View_ID view = get_active_view( app, 0 );
    write_string( app, string_u8_litexpr( "{}" ) );
    view_set_cursor( app, view, seek_pos( view_get_cursor_pos( app, view ) - 1 ) );
}

Customization layer - getting started (4coder 4.1)