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

textobject for nearest quote

Open Konfekt opened this issue 10 years ago • 2 comments

How about a textobject, let's call it u, going to the quotes closest to the current cursor position.

That is, viu selects everything in between any two curly, single, double or any other kind of quotes.

Konfekt avatar Apr 10 '14 10:04 Konfekt

I'll look to leverage the move-p/n capability of textobj-user to do this.

See how it's supported in my https://github.com/reedes/vim-textobj-sentence

Thanks for the feedback.

reedes avatar Apr 10 '14 18:04 reedes

Doing a bit of testing, I see that viq/vaq will select the previous curly double quoted string, if not already inside one. And viQ/vaQ for the curly singles.

A 'move' configuration looks feasible in my tests, but it's not clear what the pattern or suggested key mapping should be. (My textobj-sentence overrides Vim's default open and close parens for jumping between sentences.)

I'll experiment with a quote-specific move pattern that includes the user-configured double/single along with the straight quotes. It'll likely be orthogonal with textobj-sentence.

Because of http://en.wikipedia.org/wiki/International_variation_in_quotation_marks jumping to (and selecting) arbitrary quoted strings is fraught with ambiguity. There's no single pattern that works.

reedes avatar Apr 12 '14 01:04 reedes