jiangmiao / auto-pairs

Vim plugin, insert or delete brackets, parens, quotes in pair
http://www.vim.org/scripts/script.php?script_id=3599
4.09k stars 373 forks source link

Disable add second bracket near word #330

Open gelerum opened 3 years ago

gelerum commented 3 years ago

when add " -> ""request.POST, but should just one"request.POST and if " after world " -> request.POST" should just one when we try add ( it shouldn't add second if before word ( -> (request but if we add after word ( -> request()

LunarWatcher commented 3 years ago

With the exception of the quotes at the end of a word (I think, the single quote handling system may or may not have been expanded in a way that let's this be customized. Need to check when I'm out of bed), my fork has an opt-in option to do this: let g:AutoPairsCompleteOnlyOnSpace = 1

DavidFelsen commented 3 years ago

Same problem here. Not sure if I did it wrong but I tried @LunarWatcher 's fork and had the same issue: when adding a quote right before the first letter of an existing word, it still adds a closing quote so that it goes quoteme -> ""quoteme

LunarWatcher commented 3 years ago

@DavidFelsen no repro. Did you remember to let g:AutoPairsCompleteOnlyOnSpace = 1? Remember to reload the buffer if you're testing live instead of making .vimrc-updates. Off the top of my head as a possible cause if you did both, possible migration problem with your favorite plugin manager. You can make sure you're using my fork with :echo g:AutoPairsVersion. I introduced the variable in my fork, so Vim will error out if you're still on jiangmiao's repo

DavidFelsen commented 3 years ago

Fixed - Indeed the variable wasn't defined so I was still on jiangmiao's version.
I had sourced vim.init (i'm on neovim), ran vimplug to clean the old plugin, saved & closed nvim. I'm not sure why that wasn't enough (vim beginner here!), but only :edit did the trick. It works as expected now, thank you @LunarWatcher!