Zarko Coklin wrote:
It is hard to expand on Tony's feedback, ever. Still,
I found the following works a bit better. Not only
that it creates a right brace but it also places a
cursor on the right spot (taking into consideration
indentation if you set it).


:inoremap { {<CR>}<Up><CR><End>
:inoremap [ []<Left>
:inoremap ( ()<Left>

Regards,
Zarko Coklin

"The right spot" depends on your C coding style: your mapping might apply for

        if (condition) {
                statement;
                statement;
        }

and

        void function functionname(void* p) {
                statement;
                statement;
        }

though it might be better to place <CR> _after_ <End> in the {rhs} to avoid splitting a word in the middle. Mine is better for

        if (condition)
        {       statement;
                statement;
        }

and

        void function functionname(void* p)
        {       statement;
                statement;
        }

and can still be used for yours, by hitting <Enter> after the mapped {


Best regards,
Tony.
--
Taxes are going up so fast, the government is likely to price itself
out of the market.

Reply via email to