A Minimal Vim Setup That Stays Maintainable

A useful Vim configuration should make editing predictable. If opening .vimrc feels like debugging a distributed system, the configuration has won and you have lost.

Plugin management

Install vim-plug, then keep the plugin list short:

1
2
3
4
5
6
7
8
call plug#begin('~/.vim/plugged')

Plug 'preservim/nerdtree'
Plug 'preservim/nerdcommenter'
Plug 'vim-airline/vim-airline'
Plug 'morhetz/gruvbox'

call plug#end()

Run :PlugInstall inside Vim.

Practical defaults

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
set number
set mouse=a
set clipboard=unnamedplus
set hidden
set ignorecase
set smartcase
set incsearch
set hlsearch

set expandtab
set tabstop=2
set softtabstop=2
set shiftwidth=2
set autoindent
set smartindent

syntax enable
set background=dark
colorscheme gruvbox

nnoremap <C-n> :NERDTreeToggle<CR>

Use non-recursive mappings such as nnoremap unless recursive behavior is intentional. Set shiftwidth together with tabstop; otherwise indentation commands and displayed tab widths can disagree, which is a tiny argument between Vim and itself.

Keep it portable

Track .vimrc in a dotfiles repository, but keep machine-specific paths and secrets outside it. Add plugins only when a recurring problem exists. Configuration is a tool, not a hobby—unless the hobby is configuring Vim, in which case no article can save us.