Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Once you understand what c, 2, a and w mean (individually, in context), the command "c2aw" is intuitive.


Is it? I know what those characters mean, and I used to use vim, but I'm really not sure how they'd compose here. What does it mean to change and append at the same time?

In fact I just tested it and I'm still not clear what c2aw does. It seems to just do the same thing as c2w.


It does something similar to c2w if your cursor is at the beginning of a word. But if your cursor is already in the middle of a word c2aw may be faster / more intuitive than doing bc2w.

"a" can mean "append" but in this context (as the argument to a command) it means to change "a word". See :h aw for details.


It's better to think of it as "all word", as opposed to "iw" as "inner word". It's easier to think about with "it" for "inner XML tag", apply stuff only between the opening and closing tags, of "at" for the whole thing, tags included. So "dat" would delete the tag and its content, while "cit" would change the content of the tag.


That command might be intuitive to a vim user, but vim itself is anything but intuitive to someone who doesn't already know it. I'm disputing the intuitiveness of vim, which is what was claimed, not the intuitiveness of a key combination to a vim user.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: