This post is the first in a series aiming to encourage you to switch to Vim without going through that first period of significantly reduced productivity that you’re bound to go through if you follow certain Vim gurus advice such as disabling your arrow keys and what not. (This is good advice once you’ve fully mastered the basics of Vim as a way to kick bad habits, but I certainly wouldn’t advise starting that way!)
Installing Vim
I recommend you start with a graphical Vim app so that you can use your mouse to click around. Ultimately you will rarely if ever use your mouse (moving your had that far will seem really inefficient) but to start with it can significantly alleviate the frustration of being slow with the movement commands.
Mac
If you use Homebrew then you can simply issue
1
|
|
And voila, you’re done. Otherwise take a look at the MacVim instructions.
Linux
You’re going to want gVim, probably. Install it through your usual package manager.
Windows
You’re on your own.
Themes and Plugins
To get you off to a running start, I highly recommend using the Janus
vim distribution for all your plugin needs. You can install more
plugins later, but these will cover all the basics you’re likely to need
including syntax highlighting for a huge number of languages (even stuff
like Markdown files) and a vast array of colour schemes (I like
ir_black
).
If security is not a concern for you then you can run their installer via the following command:
1
|
|
Vimtutor
The first thing you should do is to try out vimtutor
- just run it
from the command line assuming it was installed with Vim. Spend 25
minutes going through everything to get a feel for Vim. Don’t worry if
it doesn’t all click into place at first - you can use Vim just like a
plain text editor at first, and slowly improve your skill over time. If
you’re a programmer and
if you haven’t used a modal editor before then I assure you it will be worth the time spent learning it.
Absolute basics
Initially you only need to worry about two of vims modes: normal mode and insert mode.
Normal mode
This is the mode that vim opens in. Here you can type commands. Typing
:w<Enter>
saves the current document. Typing i
puts you into insert
mode.
Insert mode
Insert mode is where you enter text.
Initially you can just treat it like a plain text editor
- write stuff and use the arrow keys to move around. When
you want to save, press <Esc>
to exit back to normal mode and then
type :w<Enter>
to save. You can then press i
to get back into insert
mode.
When you are in insert mode you will see -- INSERT --
displayed at the
bottom of the screen. Remember: to exit insert mode just press <Esc>
.
Moving on
Take a while to master the above before moving on. It doesn’t matter how long it takes you - the key is to avoid the frustration of having deminished productivity by trying to do too much at once.
My next post will focus on the fundamental commands in Vim, like those you touched upon in vimtutor.