I’m a big fan of Stack Overflow and I tend to contribute regularly (am currently in the top 0.X%). In this category (stackoverflow) of posts I will will be posting my top rated questions and answers. This, btw, is allowed as explained in the meta thread here.
So, my question was if for example we have this line of code:
$query = "SELECT * FROM table";
is there a command in vi/vim which can instantly delete everything between quotes and position the cursor between them so I can start typing immediatelly?
The answer, by user eugene y, was:
Use
ci"
, which means: change what’s inside the double quotes.You can also manipulate other text objects in a similar way, e.g.:
ciw
– change inside a wordci(
– change inside parenthesesdit
– delete inside an HTML tag, etc.More about different vim text objects here.