Handy Vim tricks
Search for the next/previous word in cursor
To search forward for the next word similar to the one in the cursor, use
* (asterisk). To search backward, use
Word completion on words that exist on the file
To auto-complete similar words in the file, use
Repeat the previous changes made
In this example, I replaced the
* with a
- for the bullet using the key combinations
r-. The succeeding replacements were done by just pressing
Jump to the opening/closing brackets
With the cursor either on the opening or closing bracket, press
%. Works on opening/closing parentheses or braces too.
Indent a line
To indent a line of, say, code, just press
To search incrementally, you must first enable the feature. Type
:set incsearch while on command mode.
Enable this feature first in order to get a highlighted search. Type
:set hlsearch while in command mode.
To disable highlight search, type
:nohlsearch while in command mode.