I know that I can select text inside quotes/doublequotes by issuing vi\'
or vi\"
. For example, with cursor at H
, I can select Wo
The difference between {a
,i
}×{(
,)
,b
} text-object commands
and their "
, '
, `
counterparts primarily results from the
different definitions of a block and a quoted string
(see :help v_ab
, :help v_aquote
).
While the latter is the text from the previous quote character on the
current line until the next one on that same line (escaped ones
aside), the former is the text between the nth previous unmatched
opening parenthesis and the matching closing one. Simply put, the
command va(
(without a count) is like [(v%
—if there is no
unmatched parenthesis before the cursor, both select nothing. However,
the command va"
scans the current line to find a matching pair of
quotes anyway.
The main reason for this difference in behavior, I suppose, is that quoted strings, in contrast to parenthesis, are assumed to be non-nested (at least in perspective of the built-in Vim text objects).
To select the text in the next parenthesis on the current line, one can use
%vi(
or, to include parenthesis into selection,
%va(
This comment on Hacker News points to a script supposedly solving the issue.
Untested but it's by Steve Losh so it might be good.