Right brace did not paired when cursor at the end of line and the next line was not block
For example:
...
public void some() {
...
somebody.do();
// cursor `|` here when i input a "{", the "}" did not paired.
for (.....) |
blblbl();
...
}
...
it's became:
...
somebody.do();
for (.....) {
blblbl();
...
but if the next line is block or "}", it's ok, and expand cr is ok too:
...
somebody.do();
for (.....) {}
}
...
//or
...
somebody.do();
for (.....) {}
}
Sorry @ervandew , matchem is too ingenious so that i can not fix anything....but is there possibly do not match brace more than one line is better? At your disposal :yum:
This is the intended behavior. The idea here is that it looks like you might be wrapping existing code in a new for block (your for line is directly before the blblbl(); line with no empty lines in between), so matchem errors on the side of not inserting a closing delimiter in ambiguous cases like this since, in my opinion, adding a closing delim when one is not wanted is more annoying than not adding one.
If you want, you can comment out lines 334-338 in plugin/matchem.vim to see how it behaves without that logic. It's when you go to wrap some existing code in an if that you may find the auto inserted } a bit annoying like I do.
Ok, i am trying it now, thanks for your answer @ervandew , :laughing:
And i have your idea now. Yes, you are right....it's annoying indeed.....if we can not ensure proper, do nothing always be wise. Like that example, if it's matched and if blblbl() in the if...else, i have to dd and paste it into the braces, it's more trouble.... :disappointed_relieved:
Good job!