.vimrc sample file

create ~/.vimrc and add the following content (requires vim-gtk3 for the clipboard option to work — see the vim page; also run mkdir -p ~/.vim/undodir once so the persistent-undo option below has somewhere to write):

" Enable syntax highlighting
syntax on

" Show absolute number on the current line, relative numbers elsewhere
set number
set relativenumber

" 2-space soft tabs
set expandtab
set shiftwidth=2
set tabstop=2
set softtabstop=2

" Auto-indent new lines
set autoindent
set smartindent

" Search behavior: highlight matches, search incrementally, case-insensitive
" unless the pattern contains an uppercase letter
set hlsearch
set incsearch
set ignorecase
set smartcase

" Yank/paste through the system clipboard (needs vim-gtk3, i.e. +clipboard)
set clipboard=unnamedplus

" Always show the cursor position, current mode, and partial commands
set ruler
set showmode
set showcmd

" Keep 5 lines of context above/below the cursor when scrolling
set scrolloff=5

" Enable the mouse in all modes
set mouse=a

" Persistent undo across sessions (create ~/.vim/undodir first)
set undofile
set undodir=~/.vim/undodir

" Skip redraws while running macros (faster), and skip swapfiles
set lazyredraw
set noswapfile

" Remap the leader key, then a couple of quick mappings
let mapleader = ","
nnoremap <leader>w :w<CR>
nnoremap <leader>q :q<CR>

related topics

Vim Cheat Sheet — the vim basics this config builds on.
.tmux.conf Reference — the same idea applied to tmux's config file.
.gitconfig Reference — another dotfile worth customizing early.