- Efficient Editing With vim – best laid out/organized vim tips summary I’ve seen
Recording ad-hoc macros:
qregister Start macro recording into the named register. For instance, qa starts recording and puts the macro into register a. q End recording. @register Replay the macro stored in the named register. For instance, @a replays the macro in register a. Handy code writing keys:
]p Just like p, but it automatically adjusts the indent level of the pasted code to match that of the code you paste into. Try it! % Putting the cursor on a brace, bracket, or parenthese and pressing %
will send the cursor to the matching brace, bracket, or parenthese.
Great for fixing parse problems related to heavily nested blocks of
code or logic.>> Indent
the highlighted code. (See the earlier section about efficient text
selection. If no text is selected, the current line is indented.)<< Like >>, but un-indents. gd Go to the definition (or declaration) of the function or variable under the cursor. K Go to the man page for the word currently under the cursor. (For instance, if your cursor is currently over the word sleep, you will see the man page for sleep displayed.) - Dr Chip’s Vim Page
- Luc Hermitte’s VIM Macros
- Kent’s Vim Page