I have been using Emacs since 2001, any only really learned Vim in
2007. Of course, I did quick admin edit tasks with it before, but in
2007 I had a small job where I had to develop on machines across the
ocean, with only
vim installed. As latency was high (and
didn’t exist yet), efficient use of Vim was essential. After the
summer of 2007, I was fairly familiar with Vim. I still use Emacs for
my main editing and programming tasks, but on remote machines and for
small edit tasks I primarily use Vim.
Why do you need a
.vimrc at all? Well, since Vim 8, a
is loaded else with some annoying settings (such as enabling mouse and
colors), so you have two options:
Run Vim as
vi, but then you are in compatible mode which disables some useful things.
.vimrc—even if it’s empty—to start vim in non-compatible mode. But then I can also can fetch my minimal one and set some defaults I prefer.
.vimrcis only 64 bytes long and does 80% of the job, so let’s dissect it:
set nocp bs=2 cot= hid is ru sm t_te= t_ti= vb wim=longest,list
As you can see, it only sets a few things in a single
nocompatible; disable Vi compatible mode and enable a bunch of features. This is superfluous if you save the file as
.vimrc, but not if you want to try it with
vim -u .vimrc.minimal.
backspace=indent,eol,start; allow backspace to delete the autoindent, linebreaks or the start of insert mode. This is just convenient sometimes.
completeopt=; this disables the popup menu for, e.g.,
^X^F(filename completion). I never want popups to hide the text in my buffer.
hidden; this allows having open buffers that are not displayed, and really should be the default.
incsearch; search as you type, pretty convenient.
ruler; show the current line number.
showmatch; quickly jump to the matching open bracket when typing the closing bracket.
t_te= t_ti=; unset the terminfo sequences that usually (de-)activate the alternate screen—I want the screen contents to stay after editing.
visualbell: flash the display instead of beeping.
wildmode=longest,list: In command-line mode, complete the longest common string, then list alternatives. This is the default in
readlineand how I configured my
So, in summary: 5 options enable features, 5 options disable annoying defaults. All in all, I think Vim has pretty good defaults.
NP: Pearl Jam—Buckle Up