I’m a bit obsessed with mastering
vim. I kind of feel like I’m killing kittens every time I do something inefficiently. I know plenty of commands, but you don’t truly know a command (like in the Biblical sense) until you find yourself using it without thinking. I am on a continuous mission to raise the number of commands that I know in this way. This post is my latest attempt to lock in some good ones.
I compiled this list from a wide range of other collections online, including my own tutorial, contributions from friends, and this article, which is currently my favorite stand-alone introduction to
- View/edit two files at once.
You can then switch between the windows with
- Run an external command and capture the output.
:r ! date
- Repeat your last command by typing "." (a period). So elegant.
- Auto-complete text using
ctrl-n. If the text is elsewhere in your document,
vimwill know and try and complete it for you.
- Hide blocks of text by "folding".
Highlight the area you want to fold (using
V) and press
zf. Think "f" for fold. To "open" it, press
- Quickly switch between Unix and Windows file formats.
- More easily edit code by enabling syntax highlighting.
Create a file called
syntax onin it.