Here's a link I find in stackoverflow about this question.
but I still cannot understand without a specific example about what's the difference between "change inner word" and "change word".
I test these two commands in my vim and finally find no differences ,Please give me an example to help me understand, thank you!
To quickly change a word you can use cw , caw or ciw . Use c$ or just C to quickly change from the cursor to the end of a line, cc to change an entire line, or cis for a sentence.
The control keys. For instance, using <C-w> h (or j , k , l ) will toggle between open buffers. <C-j> will move you down a line.
The cw command preprocesses any specified troff files containing English-language text to be typeset in the constant-width (CW) font. The cw command reads standard input if you do not specify a file or if you specify a - (minus sign) as one of the input file names. The cw command writes to standard output.
When you have some changes and use :q , it fails and throws an error stating No write since last change . In order to quit from the Vim without saving changes, you should write :q! , it will quit the Vim and ! will work as a negation, which will negate the write operation.
Here is an example:
foo bar baz
^
Typing cw and ciw will give the same result in this case (with the cursor positioned on the 'b' of 'bar'). Consider this:
foo bar baz
^
cw
will yield
foo b baz
^
where ciw
will yield
foo baz
^
so it changes the whole word, regardless of the cursor position. Very useful, i love this command.
Very useful is also the caw
(or the aw
) command:
foo bar baz
^
-> caw
foo baz
^
aw
also contains the space. Try these commands with the v
(visual) command, to see what they all do. Also, read motion.txt
, part 6.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With