Open budbin opened 4 years ago
I'd consider this to be a feature.
Taking your example, if you were to highlight Hello "
, via 0vf"
, running i"
would highlight everything up until the last "
(equivalent to 0v2t"
).
It's current implementation in Vim(I think) is to take the union of the inner text object at the beginning & end of a selection. For example:
A: ( B: ( C: ( ) ) )
In Vim, fBvfCi)
selects everything within the nested parenthesis. In Vis, however, this is equivalent to fBv2f)
- only selecting B: B: ( C: () )
. Note the absence of the last spaces.
I "fix" this in 3d190b6.
To reproduce, given file contents:
Hello "world"
Place the cursor at either one of the quotation marks, then from normal mode perform the sequence
vi"
. The resulting selection includes the quotation mark, rather than only the content between the delimiters. This is inconsistent with sequences such asdi"
which only affect the inside, even when the cursor is placed at the delimiter.
ci"
and di"
also change or delete anywhere on the line but vi"
does not select the contents from anywhere on the line.
For example,
_ world "hello"
If the cursor is represented by the underscore in the above example then running ci"
and di"
from that point will change or delete the five characters within the double quotes, respectively. This doesn't work for vi"
. Instead, it achieves the equivalent of vt"
in the above example.
I'm opened to being convinced why this is a bad idea.
I don't yet fully understand @jeremybobbin explanation. If someone could unpack that a bit more it would be much appreciated!
I'd also prefer the text object behaviour to be consistent.
To reproduce, given file contents:
Place the cursor at either one of the quotation marks, then from normal mode perform the sequence
vi"
. The resulting selection includes the quotation mark, rather than only the content between the delimiters. This is inconsistent with sequences such asdi"
which only affect the inside, even when the cursor is placed at the delimiter.