2 ms·
Probably just a few things contribute to most of the "productivity" you can get from vim: 1. Commands to move around the screen and file under edit: with at mo
by bediger 16y ago
Probably just a few things contribute to most of the "productivity" you can get from vim:
1. Commands to move around the screen and file under edit: with at most 2 keystrokes you can (a) move to next word (b) move to previous word (c) move to start of line (d) move to end of line (e) move to start of file (f) move to end of file (g) move 1 character in any direction (h) move to the end of next word (i) move to end of previous word (j) move to the next word like the one under the cursor (k) move to the previous word like the one under the cursor. Other commands exist to make moving around really efficient: you rarely take your hands off the keyboard to do mousing.
2. Use of regular expressions for searching for text, and as a way of distinguishing edits. You can do things like change all tabs to 4 spaces with a single command, or change the tabs at the beginning of the line to 4 spaces. This is an astoundingly powerful idea, rarely exploited however.
3. Vim, improving on vi, has the "visual" modes, where you can use movement keys (see item 1) to choose a hunk of a file, then apply edits or change commands to that block.
4. Vim isn't really modal like all the propaganda has you believe. Sure, 'i' or 'a' or 'I' or 'O' will put you in what you can naively interpret as "literal typing mode". But you should really think of those as commands, followed by text, as you can do 5Ax<esc> and append 5 'x' characters to the end of the line. If you think about what most people call "modes" correctly, you can pull off a lot of interesting and fast edits.
5. It's fast and has very few built-in limits (line length, file size, window size etc etc).