set nocompatible

" Enable line numbering
set number

" Configure backspace so it acts as it should act
set backspace=eol,start,indent

" Allow arrow keys to wrap onto the previous/next line.
set whichwrap+=<,>,h,l

" Enable syntax highlighting if available
if has("syntax")
	syntax on
endif

" Highlight search results
set hlsearch

" Show “invisible” characters
set list lcs=tab:→\ ,space:·,nbsp:␣
"eol:¶
highlight SpecialKey ctermfg=darkgray
highlight Nontext ctermfg=darkgray

" Set utf8 as standard encoding
set encoding=utf8

"filetype detection, language-specific plugins, and automatic indentation
filetype plugin indent on

" Make tabs as wide as two spaces
set tabstop=2

" Copy indentation from previous line
set smartindent
set autoindent

" Show the current mode
set showmode

" Show the filename in the window titlebar
set title

" Show the (partial) command as it’s being typed
set showcmd

" Centralize backups, swapfiles and undo history
set backupdir=~/.vim/backups
set directory=~/.vim/swaps
if exists("&undodir")
	set undodir=~/.vim/undo
endif

" :W sudo saves the file (useful for handling the permission-denied error)
command! W execute 'w !sudo tee % > /dev/null' <bar> edit!
