Vim Configuration

Essential .vimrc configuration and settings

Basic Settings

# ~/.vimrc file
set number # show line numbers
set relativenumber # relative line numbers
set tabstop=4 # tab width
set shiftwidth=4 # indent width
set expandtab # use spaces not tabs
set autoindent # auto indent new lines

UI & Display

syntax on # enable syntax highlighting
set background=dark # dark color scheme
colorscheme desert # set color scheme
set cursorline # highlight current line
set showmatch # highlight matching brackets
set ruler # show cursor position

Search Settings

set hlsearch # highlight search results
set incsearch # incremental search
set ignorecase # case insensitive search
set smartcase # case sensitive if uppercase
set wrapscan # wrap search at EOF

Key Mappings

# Leader key
let mapleader = space # set leader to space

# Custom mappings
nnoremap leader w :w CR # save with space+w
nnoremap leader q :q CR # quit
inoremap jk Esc # jk to escape

Advanced Settings

set clipboard=unnamedplus # system clipboard
set mouse=a # enable mouse
set wildmenu # command completion
set backup # enable backups
set undofile # persistent undo
set encoding=utf-8 # UTF-8 encoding