vim-textobj-quote icon indicating copy to clipboard operation
vim-textobj-quote copied to clipboard

How to integrate with rhysd/vim-operator-surround?

Open reedes opened this issue 9 years ago • 3 comments

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.

reedes avatar Aug 27 '14 08:08 reedes

I'm already using this integrated with vim-surround, I imagine this should be an easy addition.

alerque avatar May 12 '20 14:05 alerque

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.

alerque avatar Jun 01 '20 07:06 alerque

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.

telemachus avatar Jan 04 '22 15:01 telemachus