7 Relatively Unknown But Very Powerful Vim Features
By Daniel Miessler on January 14th, 2007: Tagged as Linux | Programming | Vim
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 vim.
- View/edit two files at once.
:vsplit foo.txt

You can then switch between the windows with
ctrl-ww. - 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
vorV) and presszf. Think “f” for fold. To “open” it, presszo.
- Quickly switch between Unix and Windows file formats.
Type
:set filetype=Unixor:set filteype=dosrespectively. - More easily edit code by enabling syntax highlighting.
Create a file called
~/.vimrcand putsyntax onin it.












Add New Comment
Viewing 1 Comment
Thanks. Your comment is awaiting approval by a moderator.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Add New Comment
Trackbacks
(Trackback URL)
15/01/07 at 8:03 PM
[...] So today I was pleased when I read an article giving some helpful Vim tips. It’s a great resource ...
21/01/07 at 11:08 PM
[...] 7 Relatively Unknown But Very Powerful Vim Features Who knew Vim had so many interesting features? (tags: vim vi) ...