4

Assuming the following situation

$someVar = "Some String with \"escaped\" inner delimiters";

with the cursor somewhere in the double-quote delimited string.

What is the quickest way to jump to the final (actually delimiting) double quote? I can only think of 3f"/f" depending on where the cursor is, or even using a negative lookbehind with /, but there has to be a better way?

Is there perhaps even something like "jump to the end of the current syntax-highlighted block"?

6

@Kent's solution assumes a single string in the line. Another approach is (mis-)using the a / inner quoted string text object (a" / i"), through visual mode:

  • va"<Esc> for :set selection=inclusive (default)
  • vi"<Esc> for :set selection=exclusive

@Kent's solution also doesn't work as a single, atomic {motion}, so you cannot use it after commands like d or y. That can be done via the vim ninja feet plugin as d]i".

0
$F"

This goes to the end of the line, and searches backwards for ".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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