auto-pairs
auto-pairs copied to clipboard
Is it possible to prevent the creation of the pair if there is a non whitespace character immediately after the cursor?
This is inspired by sublime text. Try it, it will make the closing pair, but not if you are inserting text.
Is this possible?
+1 from me. Especially useful when you have following scenario:
if(a == b){
Now i want to add another condition
if<position cursor here and type (>(a == b){
Currently it ends like this:
if()(a == b){
It would be nice if it would only insert the opening brace:
if((a == b) && ...
+1. I'd like to have this option as well. Too many times I'm correcting existing code and end up like this.
A workaround i sometimes am able to remember to use is vim-surround visual mode. it's handy
I implemented this in my fork: https://github.com/eapache/auto-pairs
You can use that until @jiangmiao decides to merge my PR.
+1 for this feature. Thanks!
Thank you @eapache , it took me a long time of scratching my head and looking at the git log (which has really confusing date chronology) but I had already merged in your branch for months but only now I learned you have to g:AutoPairsOnlyWhitespace = 1
to put it into effect.
(this is partially just a note to self for me to dig into eapache's changes and add these cases 😉)
- Any chance we can add an exception for when the offending following character happens to be the close side of another pair?
For example if you type
('
I'd like for it to insert('')
(where the cursor is now in the middle) but with this new fix it sees the inserted)
instead of a whitespace and so the'
does not get paired anymore and we're left with(')
and now have to manually add the closing'
- extend this with some more cases. For example, if the immediately following character is a comma, I would like the pairing to proceed as before. For example, when writing a new argument to a function call (and I'm typing a function call or a string).
thanks, @eapache Any ideas, why this feature wasn't merged yet?
@gyermolenko just FYI I have since gone back to using jiangmiao's branch.
- see my Jan 24 comment, skipping triggering on nonwhitespace raises more problems. If I can get to it I would look into extending with those ideas to make the nonwhitespace behavior more friendly, and then merging it in
- new behavior just went in that fixes undo breakage. it's very nice, you can use
.
to repeat things typed in which triggers auto-pairs now.
@unphased , Hi, thanks for reply.
Although I have this adorable piece of vimrc inoremap <C-d> <Del>
I still sometimes hate when brackets close at their will. So, I will try to live with (')
and (,
for some time )
+1 On this one.
Since I am interested by this feature, I am not sure to understand whether it has been merged or not ?
Thank you in advance.
+1
+1