cohama / lexima.vim

Auto close parentheses and repeat by dot dot dot...
995 stars 46 forks source link

Inserting parens before other parens #72

Closed jonashaag closed 2 years ago

jonashaag commented 6 years ago

Current behaviour:

Before        Input         After
------------------------------------
|()           (             (|)()

Sometimes it's the right thing to insert the closing parenthesis as well, but sometimes it's not what the user wants. I believe the following outcomes are legitimate use cases:

      Before        Input         After
------------------------------------
(1)   |(...)        (             (|)(...)
(2)   |(...)        foo(          (|(...)
(3)   |(...)        foo(          (|(...))

My suggestion is to never insert a closing paren if the symbol following the cursor is a paren: Having to type a closing paren in some situations lexima doesn't support is perfectly fine. What annoys me is deleting an incorrectly inserted paren because it means I have to leave insert mode, press L, press X, and enter insert mode again.

jonashaag commented 6 years ago

This also bugs me when trying to wrap a word in quotes, e.g. |foo --> ' --> '|'foo

anthrotype commented 5 years ago

I found this plugin https://github.com/Raimondi/delimitMate seems to do the right thing in this case

cohama commented 5 years ago

This is intended. It is sometimes good but sometimes annoying, even for me.

My choice is that

In these case, I often use vim-surroud.