" Enable all mouse features
set mouse=a

" TODO: spellcapcheck
" TODO: virtualedit=block
" TODO: whichwrap=b,h,l,s,<,>,[,],~

" Don't show completeopt preview buffer
if has('insert_expand')
  set completeopt-=preview
endif

" Set window title to titlestring
if has('title')
  set title
endif

" Don't show mode in command line
set noshowmode

" Show relative line numbers & current line number
set number
set relativenumber

" Keep cursor from buffer edges
set scrolloff=8

" Turn backup off
set nobackup noswapfile
if has('writebackup')
  set nowritebackup
endif

" Wrap to whole words
set wrap nolist
if has('linebreak')
  set linebreak
endif

" Don't add 2 spaces after end of sentence
set nojoinspaces

" Use Unix as standard file type
set fileformats=unix,mac,dos

" Allow : in filenames to allow gf to specify line numbers
set isfname-=:

" Highlight search matches & show search matches while typing
set hlsearch

" Set ignore search case unless mixed
set ignorecase smartcase

" Allow buffers with changes to be hidden
set hidden

" Open new splits on the other side of the axis
if has('windows')
  set splitbelow
endif
if has('vertsplit')
  set splitright
endif

" Use existing windows and tabs when jumping to errors
set switchbuf=usetab

" Indicates a fast terminal connection
set ttyfast

" Set syntax as default fold method
if has('folding')
  set foldmethod=syntax foldlevel=20
endif

" Automatically write changes to files
set autowrite

" Format text
"   r - insert comment leader on 'o' and 'O'
"   q - allow formatting with 'gq'
set formatoptions+=rq

" Enable modeline
set modeline

" Don't redraw during execution macros, registers, commands, etc.
set lazyredraw