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

A commonly overlooked aspect to the vim way of describing what you're doing in verbs and nouns and prepositions is that the "." character in vim means "repeat my previous edit". So if you can find a way to "phrase" your edit as a single change (i.e., 6sasdf<esc> would delete six characters starting under the cursor and leaving me in insert mode, then insert the letters asdf and exit insert mode) instead of many (i.e., xxxxxxiasdf<esc>, deleting 6 characters separately, entering insert mode and entering the letters asdf) then you can go to another spot in the text and just hit . to repeat the edit. I've given a contrived example here, but this is enormously powerful. It's why there are several ways to enter insert mode: "i" to enter under the cursor, "a" for after the cursor, "I" for first non-whitespace character on the line, "A" for after the last character on the line, "o" for opening a new line below the cursor, "O" for above, "c"+motion for deleting through the motion and leaving in insert mode, count+"s" for removing count characters starting from cursor and leaving in insert mode. There are more....I'll stop :)


Sublime Text supports multiple cursors, which I find to be a more natural way to do things where you might use those tiny repetitions-- you select all the regions you want to edit first (usually by repeatedly adding the next match to the selection), then any typing or movements you do occur in parallel.




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

Search: