The vi`
motion from stock Vim will not work, since i`
(and a`
or i'
or i"
) only work on a single line of code. See :help v_a`
for more details.
But it turns out there's a plug-in that helps here, plug-in wellle/targets.vim extends many of the built-in motions and text objects, `i`` included, to make them more powerful.
In particular, it supports multi-line contents inside quotes. As stated in the README file:
Quote Text Objects
These text objects are similar to the built in text objects such as i'
. [...]
These quote text objects try to be smarter than the default ones. They count the quotation marks from the beginning of the line to decide which of these are the beginning of a quote and which ones are the end. [...]
Quote text objects work over multiple lines and support seeking. [...]
The targets.vim defines many other very useful text objects, such as function arguments and also using n
and l
to match the "next" or "last" (previous) text object of that kind (e.g. in'
for the next single quoted string, ip'
for the previous one.)
vi`V
will not work sincei`
(anda`
ori'
ori"
) only work on a single line of code. See:help v_a`
for more details. In part, the reason these can't easily work on multiple lines is that you don't have an open and close version of them (as you do with{}
or[]
or()
...) Anyways, this might require some thinking outside the box to figure out.