lexima.vim
lexima.vim copied to clipboard
Do not insert right parentheses when there is an unmatched right parenthess
Example:
fuinction(|b))
If you press (
, the result should be
fuinction((|b))
rather than
fuinction(()|b))
.
It would be difficult to implement this feature.
Please use <C-v>(
.
How does lexima** decide whether the following case has matched paren or not?
var a = [1,2,3].reduce(function(acc, x) {
return acc + x
}, calcInitValue(|b));
It is easy for human but Vim not.
The reason I hope lexima has this feature is because delimitMate won't insert the right parentheses in that case. You can read the section 3.4 and 3.5 in https://github.com/Raimondi/delimitMate/blob/master/doc/delimitMate.txt
In delimitMate, it has two heuristics:
- Try to match the right of your cursor using regex from
b/g:delimitMate_smart_matchpairs
. If that matches, it won't insert the right parentheses. I find the defaultg:delimitMate_smart_matchpairs
works quite good in practice. - If
delimitMate_balance_matchpairs
is set, it will try to balance the matching pairs in current line.
I have to confirm: current behavior is very annoying. It would be great to have such functionality.
Sorry for slow responce. I will try to solve this problem.