Brian Jones
Dec 17, 2018 · 2 min read

Learning vim can be difficult. Which key does what can be unintuitive (e.g., copying in vim is done with a y which stands for yank), the difficulty involved in quitting vim is a meme, and a lot of the default settings aren’t great. Here I try to help with the last part, configuring your vim settings.

Table of Contents

Getting Started

So you’ve decided to use vim! Or, more likely, you’ve been told that you should use vim by someone convincing. The good news is that vim is very configurable and anything that you don’t like can probably be changed. The bad news is that the default configuration can be pretty bad (depending on your system) and this can make it hard to get started.

As a heads up, this isn’t a vim tutorial. I make no effort to teach you how to use vim, just how to do some configuration. A basic intro to vim can be found by running vimtutor from the command line.

I also assume that your vim is relatively modern. If your version of vim doesn’t support an option below, you can upgrade your version of vim (which I would recommend) or just delete that option from the .vimrc.

Basic Configuration

Most of your vim configuration goes in ~/.vimrc. Here are some of the more common options along with explanation of what they do.

Note: in the .vimrc any text after a " is ignored. These are called comments.

Are there more options? Yes! There are lots! For a quick (quick is a relative term) overview of all of them, run :help option-list from inside vim (:q to quit the help page). For a detailed list of all of them, run :help options (and again :q to quit). Vim also has other help pages (lots of them) that go into thorough detail on every topic (well, every vim topic) you could possibly wonder about (you can run :help by itself for a help page that lists the help pages...).

I Just Want to Copy and Paste

WARNING: This will delete anything you already have in your .vimrc. I do it that way because some vim options are incompatible with each other or lead to unintuitive results when mixed. If you have anything you like and don't want to lose, then just selectively pick and choose what to add from the above.

cat << EOD > ~/.vimrc
set nocompatible
set nomodeline
filetype plugin indent onsyntax onset mouse=aset wildmode=longest:full,full
set wildmenu
set textwidth=80
set formatoptions=cq
set numberset scrolloff=5set backspace=indent,eol,start
set whichwrap+=<,>
set autoindentset softtabstop=3 shiftwidth=3 expandtab shiftroundset incsearchset ruler
set showcmd
EOD

The New Blackboard

Providing a community for current and past Cal Poly Mustangs in the Computer Science Department to share their experiences to better the future for incoming students and disrupt the stereotype of the typical programmer

Brian Jones

Written by

The New Blackboard

Providing a community for current and past Cal Poly Mustangs in the Computer Science Department to share their experiences to better the future for incoming students and disrupt the stereotype of the typical programmer

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade