Can you try this to see whether it does what you want ?:
:imap <Enter> <Enter><space><bs>
I get the following behavior:
When I press 'o', it starts an empty line correctly indented. If
I press 'escape' immediately, the indentation is removed and the
cursor moves to column 1. If I press 'enter' instead, the
indentation is removed for the first line, but the subsequent lines
remain indented when I finally press 'escape'. Picture:
if(1 < 2)
{
int i; // press 'o' here.
. // press 'enter' here: not correctly indented.
. // press 'enter' here: correctly indented.
. // press 'escape' here: correctly indented.
}
I tried adding ':imap o o<space><bs>', but it made no difference.
I suspect that 'vim' checks if the line is really empty and thus
is not fooled by the 'space'-'backspace' sequence.
Thanks for the help!
Laurent Birtz