2

As title. I have tried change this option:

matchpairs

but the result is weird: it will jump to all previous ' if pressed multiple times

1 Answer 1

3

From :help matchpairs is this...

Only character pairs are allowed that are 
different, thus you cannot jump between two 
double quotes.

... in other words, the syntax of matchpairs is "openchar:closechar", where openchar must not be the same as closechar.

these are valid pairs...

:set matchpairs=[:]
:set matchpairs={:}
:set matchpairs=(:)

but these are invalid, since the open and close characters are the same character...

:set matchpairs=':'
:set matchpairs=":"

... so, as you can see, matchpairs isn't your solution.

I do not know of a plugin that satisfies your need. Many plugins are smart enough to modify the text between single and double quotes (the surround plugin comes to mind), so you would think adding the ability to use '%' to move back and forth between the open quote and close quote would be quite doable. I don't have the skills to write a solution for you, nor have I found an existing plugin that solves this. Such a plugin may indeed exist, I just haven't found it yet.

I realize this isn't the answer you're looking for. But perhaps it steers you in the right direction.

1
  • It helps :) Really thank you for pointing this out! Feb 15, 2022 at 3:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.