2 ms·
After some practice with Vim I started to think about editing in terms of Vim's commands. That made me very effective. And it's not only about h j k l. It gives
by grn 16y ago
After some practice with Vim I started to think about editing in terms of Vim's commands. That made me very effective. And it's not only about h j k l. It gives you many small tools that you can combine. The basics are actions and movements. Let me give you a few basic examples.
Some movements are:
- h, j, k, l,
- f <char> - the given character,
- w / b - beginning of the next / previous word,
- 0 / $ - beginning / end of the line.
Some actions:
- d - delete
- dd - delete whole line
- y - yank (copy to the Vim's clipboard)
- p - paste
- c - change
- <n> G - go to the n-th line.
Their combinations could be:
- d f . - delete from the cursor to the first period
- d w - delete the current word
- c w - change the current word
- d 0 - delete to the beginning of the current line
- dd 10 G p - delete the current line (that also puts it in the Vim's clipboard), move to the 10th line and paste the deleted one there.
Of course it gives you much more: searching, replacing, scripting, plug-ins, syntax highlight, auto-completion, browsing etc.
- bcrescimanno 16y agoFair enough--but that's more of a "cheat sheet" than anything else, you know? Learning the commands and committing them to muscle memory is part of the learning process for any app. Vim is known to be generally difficult (or at least time consuming) to learn because you have to first digest what the commands are before you can work on getting them into muscle memory. The question is: what features did you find that decided it was worth it to switch? If not for the feature itself, then how does the paradigm of its usage help you? For example, ci{ is often cited by developers is awesome. It's so much faster than highlighting text within curly braces and changing it so while it's a pretty simple thing, Vim's implementation makes it a breeze to use.