-set undofile
-set undodir=$HOME/.local/state/vim//
-
-set autoindent
-set colorcolumn=80
-highlight ColorColumn term=NONE ctermbg=0
-autocmd FileType python setlocal tabstop=4 shiftwidth=4 expandtab
-autocmd FileType markdown setlocal tabstop=4 shiftwidth=4 expandtab
-autocmd FileType javascript setlocal tabstop=2 shiftwidth=2 expandtab
-autocmd FileType json setlocal tabstop=2 shiftwidth=2 expandtab
-autocmd FileType html setlocal tabstop=2 shiftwidth=2 expandtab
-autocmd FileType todo setlocal colorcolumn=0
-
-set cursorline
-set hlsearch
-set list
+
+unlet x
+unlet y
+
+""" vim-only defaults
+if !has('nvim')
+ " neovim defaults are already set
+ source $VIMRUNTIME/defaults.vim
+
+ " disable jumping to last edit, we use vim-lastplace instead
+ autocmd! vimStartup
+
+ " packages
+ packadd! matchit
+ packadd! editorconfig " this is now built to [n]vim in but optional
+ packadd! vim-commentary " nvim has built in commenting now
+
+ " options
+ set hlsearch
+ autocmd BufRead * set autoindent
+endif
+
+""" styling
+" nice default theme
+colorscheme murphy
+
+" always use color column with less intrusive colors
+autocmd VimEnter,WinNew * set colorcolumn=80
+" always use cursor line for better visibility
+autocmd VimEnter,WinNew * set cursorline
+
+" unique highlighting for leading spaces and in-line spaces
+" NOTE: this leaves tabs and other special whitespace untouched intentionally
+autocmd VimEnter,ColorScheme * highlight SpaceInner ctermfg=Grey guifg=#686868
+autocmd VimEnter,ColorScheme * highlight link SpaceOuter NonText
+autocmd VimEnter,WinNew * match SpaceInner / /
+autocmd VimEnter,WinNew * 2match SpaceOuter /\(^ \+\)\|\( \+$\)/
+
+" always show statusline
+set laststatus=2
+
+" truncate > lastline; lastline is nvim default, sensible.vim may also set it
+set display=truncate
+
+" more context while scrolling
+set scrolloff=5
+set sidescrolloff=8
+
+" show number column on all buffers
+autocmd VimEnter,WinNew * set number
+" use relative numbers in normal modes when focused, but not if number is off
+function! s:SetRelativeNumber(enable)
+ if !getwinvar(winnr(), '&number')
+ return
+ endif
+ if a:enable
+ set relativenumber
+ else
+ set norelativenumber
+ endif
+endfunction
+autocmd InsertEnter,FocusLost,WinLeave * call s:SetRelativeNumber(0)
+autocmd VimEnter,WinNew,
+ \InsertLeave,FocusGained,WinEnter * call s:SetRelativeNumber(1)
+
+" always show custom listchars
+autocmd VimEnter,WinNew * set list