CI inconsistency


#1

I find ci behaviour a bit confusing.
When doing ci" and my cursor is in front of the ", it goes inside the "" and works as expected.
When I do ci{ and my cursor is in front it does nothing, I need to have my cursor on the first or last { for it to work as I want.
Now I read an explanation that vim doesn’t necessarily expects " to come in a pair and I can’t get that. It’s weird.
(Here’s where I read it: https://stackoverflow.com/questions/14650788/why-ci-and-ci-ci-behave-differently/#answer-14651443)
I find it weird because if I do -change inside- it means there’s something to open and something to close.
Also: if I have a longer paragraph inside two ", ci doesn’t want to work…
If the same paragraph is inside brackets, it works as expected.


#2

Reading that article it does make sense that Vim’s pair matching struggles to match pairs of ". It’s not that logically it doesn’t know open quote - close quote. It that both open and close quotes are identical, unlike open bracket - close bracket which face different ways visually (and have difference keys ASCII parameters in terms of data).

With ci" it has to work out if it is looking at a the opening " or the closing " before it can change anything. It has a stab, but without lots of scanning left and right, particularly with long strings, it may get it wrong.

As for the cursor placement, its not an issue I have so cannot comment.


#3

So first up, remember that i goes with a few things: ci, vi, di, and yi off the top of my head.

Next, yes, i as used for inside is inconsistent, like you see me do in the book. I believe there’s a way to fix it, but for the most part it works with only a few bounding characters.