vim-textobj-quote
vim-textobj-quote copied to clipboard
How to integrate with rhysd/vim-operator-surround?
It'd be nice to use the https://github.com/rhysd/vim-operator-surround to add/replace quotes around text objects.
It likely involves an entry to g:operator#surround#blocks
.
I'm already using this integrated with vim-surround
, I imagine this should be an easy addition.
I take that back, it looks like I'm using my own fork of tpope's vim-surround
with a fix that was rejected upstream that specifically enables integration with this plugin. I'll have to look into what that was even about so we can document how it should work together with that as well as vim-operator-surround
.
Here's another alternative for future visitors to consider.
I use machakann/vim-sandwich. Although this plugin doesn't know about smart quotes out of the box, you can add custom recipes to vim-sandwich relatively easily.
Here's what I do.
" Save all default recipes to our newly defined batch of recipes.
let g:sandwich#recipes = deepcopy(g:sandwich#default_recipes)
" Teach vim-sandwich about “foo” and ‘foo’
let g:sandwich#recipes += [
\ {'buns': ['“', '”'], 'nesting': 0, 'input': ['q"']},
\ {'buns': ['‘', '’'], 'nesting': 0, 'input': ["q'"]},
\ ]
See the README and documentation for more details.