preservim / vim-textobj-quote

Use ‘curly’ quote characters in Vim
Other
123 stars 6 forks source link

textobject for nearest quote #3

Open Konfekt opened 10 years ago

Konfekt commented 10 years ago

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.

reedes commented 10 years ago

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 commented 10 years ago

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.