Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not insert right parentheses when there is an unmatched right parenthess #58

Open
zhou13 opened this issue May 9, 2016 · 5 comments

Comments

@zhou13
Copy link

zhou13 commented May 9, 2016

Example:

fuinction(|b))

If you press (, the result should be

fuinction((|b))

rather than

fuinction(()|b))

.

@cohama
Copy link
Owner

cohama commented May 9, 2016

It would be difficult to implement this feature.
Please use <C-v>(.

@cohama
Copy link
Owner

cohama commented May 9, 2016

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.

@zhou13
Copy link
Author

zhou13 commented May 9, 2016

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:

  1. 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 default g:delimitMate_smart_matchpairs works quite good in practice.
  2. If delimitMate_balance_matchpairs is set, it will try to balance the matching pairs in current line.

@zhou13 zhou13 changed the title Do not insert left parenthess when there is an unmatched right parenthess Do not insert right parentheses when there is an unmatched right parenthess May 9, 2016
@petRUShka
Copy link

I have to confirm: current behavior is very annoying. It would be great to have such functionality.

@cohama
Copy link
Owner

cohama commented Jun 13, 2016

Sorry for slow responce. I will try to solve this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants