I use Vim to edit C code, and I like to use c<movement> to quickly change parts of my file. In particular, I find things like c2W useful for "changing two words separated by spaces."
But there is one case that eluded me: when my cursor is at the last character of a word, the cb command, "change the word back" does not delete the last character of the word that I want to edit. This makes sense since the cursor was technically up to that last character, but that is not what I want.
Here, what happens, with the cursor marked | :
Start with:
This is just a typ|ical series of words
I would like to change “typical” to “different”. I press e :
This is just a typica|l series of words
And then cb :
This is just a |l series of words
Now there hangs l (lowercase L, to be clear) left! This is not what I wanted.
The more discerning of you have already noticed that in this example I could just use the combination bcw , which would put my cursor at the beginning of the word and then change it all over the word. True! But what if I wanted to change the “words” to “lines”?
Start with:
This is just a typ|ical series of words
I would like to change the “words” to “lines”. I press $ :
This is just a typical series of word|s
Same problem! Pressing cb will cause the s to freeze (although in this example it will be good, since the strings end with s anyway). Of course, I could press bcw , but this is another key and therefore unacceptable.
Do I just need to live with these incredible difficulties?