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
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
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 nomodelinefiletype plugin indent onsyntax onset mouse=aset wildmode=longest:full,full
set wildmenuset textwidth=80
set formatoptions=cqset numberset scrolloff=5set backspace=indent,eol,start
set whichwrap+=<,>set autoindentset softtabstop=3 shiftwidth=3 expandtab shiftroundset incsearchset ruler