Setup Vim

Install a plugin manager and get my configs

This is the first in a series of Vim tutorials. Make sure you follow each step exactly. It’s simple enough, but it can be surprisingly easy to muck-up a setup.

Make the right files

First you’ll need to create two files: .vimrc to hold your Vim configuration, .vimrc.bundles to store your plugins.

$ cd ~
$ touch .vimrc
$ touch .vimrc.bundles

You can confirm they now exist by running $ ls -a (. files are hidden files).

Install Vundle

Vundle is a Plugin manager for Vim, analogous to bundler for Ruby or npm for JavaScript. You’ll need it to add nifty extensions to Vim’s functionality created by others in the Vim community.

First, head over to Vundle’s Github page. Assuming you have Git, follow steps 2 and 3 under the ‘Quick Start’ section. For step 3, open your brand new .vimrc file in your preferred text-editor and paste in everything from the box like so:

Then, launch vim:

$ vim
Vim’s welcome screen

And run :PluginInstall:

After you hit return, something like this should happen (except with fewer Plugins):

Now, :q to get out of the Installer and :q again to exit vim.

(If you ever get any scary screens on Vim, :q or ctrl-c are lifeboats).

Get my setup (optional)

There’s a culture in the world of Vim of inheriting other users’ configuration files. I’m torn about whether this is a good thing.

On one hand it can make the learning process a bit smoother to set up your Vim with a more experienced user’s settings. On the other it’s great to understand what Vim is out-of-the-box and build your own configuration tailored for your own needs.

I inherited the setup of my coach, who inherited his setup from someone else. I’ve since customised it a bit, commenting out Plugins I didn’t like and adding a few of my own. If you choose to use mine, I encourage you to do the same.

My Vim configuration files are hidden in a secret location. Here.

Remember all that stuff I just told you to put in your .vimrc file? Delete it and copy over everything in my .vimrc.

Then, about three-quarters of the way down my super secret location, copy the contents of my .vimrc.bundles file into yours.

Once again, launch vim (You might see an error message regarding my colour scheme. Just ignore it and hit return) and run :PluginInstall. This might take a couple of minutes.

You should see this, which is confirmation that everything has worked correctly:

Again, use :q to exit vim.

Say goodbye to Caps Lock

When using Vim you’ll find yourself regularly reaching for the escape key to switch ‘modes’. If you’ve got a telescope handy, you might spot it way out in the top left corner of your keyboard. This is no good.

For Mac users, go to System Preferences, Keyboard, Modifier Keys, and assign the Caps Lock key to Escape. You wont miss it. Besides, Vim has its own ways of capitalising things (~).

Celebrate

You just made Vim much less scary, and now have the ability to install all the plugins your heart desires. When you’re ready, hunt for some more over at Vim Awesome and Vim.org.

If you read past the tapir, chances are you read the whole thing. If you enjoyed it, please click the little heart below. It’ll help others find this and enjoy it too.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.