Reputation: 1576
Question is in the title but an example will explain it better. Suppose I am editing a config file with vim and want to change this line
uid = www-data
to
uid = anotheruser
the ci" is perfect for me when the value is between quotes ( cf How to replace text between quotes in vi ) but when it's not I resort to use insert mode (for now). What would you use to get the job done faster ?
Upvotes: 0
Views: 468
Reputation: 2470
As an alternative to your ci" when the text is in between quotes you could in this scenario use the WORD text-object.
Putting your cursor somewere inside www-data
and press ciW
Read more about text-objects by typing :h text-objects
But personally I would use also the C command which changes the text from cursor to the end of the line, as already mentioned by others. Probably something like this /www<CR>Canotheruser<ESC>
Upvotes: 2
Reputation: 406
Assuming your cursor is somewhere on www-data
I would do T<space>Canotheruser
.
T{char} moves the cursor to left until the it is just after the first occurrence of {char}
C is a short hand for c$ which deletes from the cursor to the end of the line and enters insertion mode.
Upvotes: 2
Reputation: 5954
Use c$ to delete text to the end of line.
Put cursor on the first w
of uid = www-data
and then use c$.
Upvotes: 0