5 ms·
Actually "cw" doesn't change the current word.. it changes where the cursor is to the end of the word. Something I tend to use a lot is: (| is the cursor) ci
by d0m 15y ago
Actually "cw" doesn't change the current word.. it changes where the cursor is to the end of the word. Something I tend to use a lot is: (| is the cursor)
ciw (Really change the current word. "Fo|o Bar" -> "| Bar"
ci" (Change in between ": "Test 12|34" -> "|"
da" (Delete in between " AND the "": a"Test 12|34"b -> ab
Also, plugins are extremely important. For instance, one of my favorite makes the "w" smarter for day to day programming word. (I mapped it to ,w) For example:
"pac|kageManager" ci,w "|Manager"
"pac|kage_manager" ci,w "|_manager"
- d0m 15y agoOh, and the surround plugin is so useful.. something I tend to do a lot is: viws' : viw "highlight the current word" and s' surrounds it with ''. *Soooooo* useful. You can also do yiws' but I like to see what will be surrounded as something there're spaces or other characters which doesn't *count* in "w".
- yogsototh 15y agoOf course, you're right, I fixed that. And many people asked for a text_object section. I'll certainly add it.
- d0m 15y agoThanks for the guide. If I might suggest another small gem that beginners would appreciate, is a way to copy text with a mark. I.e. ma go to the end y`. It may be easier than vwwwwwwww y or something similar.
- mattsacks 15y agoEven better - "ay$ or, yank from cursor til end of line into register a. Paste with "ap
- beaumartinez 15y agoExactly—use text objects. :h text-objects To be consistent with dw you can use caw which will delete until the next word, not just the current word.
- tudorizer 15y agoI use that da" very often, but for some strange reason it stuck in my brain as abbreviation from 'delete around "', which is inaccurate. Thanks for making me realize this.
- pyre 15y agoBetter to think of if as 'delete a' or 'delete in': da" => 'delete a "-block' di" => 'change in "-block'
- billybob 15y agoYes, "delete a" and "delete inner" is how Vim explains these text object operations. See ":help da", for example.
- ambrosebs 15y agoFWIW I would pronounce it "delete all".
- majika 15y agoWhich plugin is that?