-set number
-set relativenumber
-autocmd InsertEnter * setlocal norelativenumber
-autocmd InsertLeave * setlocal relativenumber
-autocmd FocusLost * setlocal norelativenumber
-autocmd FocusGained * setlocal relativenumber
-highlight WhiteSpaceBol ctermfg=DarkBlue
-highlight WhiteSpaceMol ctermfg=Black
-match WhiteSpaceMol / /
-2match WhiteSpaceBol /\(^ \+\)\|\( \+$\)/
-
-" vim: set et fenc=utf-8 ft=vim sts=4 sw=4 ts=8 tw=79 :
+
+""" editor
+" always save undo file for all file buffers
+autocmd BufRead * set undofile
+
+" explicitly use modeline, even on systems where it's disabled by system vimrc
+autocmd BufRead set modeline
+" should be default disabled but just in case
+set nomodelineexpr
+
+"" indent
+" always use shiftwidth instead of tabsize
+set smarttab
+" filetype preferences
+autocmd FileType python set softtabstop=4 shiftwidth=4 expandtab
+autocmd FileType markdown set softtabstop=4 shiftwidth=4 expandtab
+autocmd FileType javascript set softtabstop=2 shiftwidth=2 expandtab
+autocmd FileType json set softtabstop=2 shiftwidth=2 expandtab
+autocmd FileType html set softtabstop=2 shiftwidth=2 expandtab
+let g:EditorConfig_enable_for_new_buf = 1
+
+"" syntax
+autocmd FileType todo set colorcolumn=0
+
+"" mappings
+" use more accessible escapes, as C-n and C-o are shadowed by some terminals
+if has('nvim')
+ tnoremap <C-\>n <C-\><C-N>
+ tnoremap <C-\>o <C-\><C-O>
+endif
+
+" move windows any time
+if has('nvim')
+ " terminal
+ tnoremap <A-h> <C-\><C-N><C-w>h
+ tnoremap <A-j> <C-\><C-N><C-w>j
+ tnoremap <A-k> <C-\><C-N><C-w>k
+ tnoremap <A-l> <C-\><C-N><C-w>l
+endif
+" insert
+inoremap <A-h> <C-\><C-N><C-w>h
+inoremap <A-j> <C-\><C-N><C-w>j
+inoremap <A-k> <C-\><C-N><C-w>k
+inoremap <A-l> <C-\><C-N><C-w>l
+" normal
+nnoremap <A-h> <C-w>h
+nnoremap <A-j> <C-w>j
+nnoremap <A-k> <C-w>k
+nnoremap <A-l> <C-w>l
+
+"" CTRL-L to clear highlighting and also update diff
+" NOTE: sensible.vim and nvim already do this, so copy sensible.vim
+" functionality if it hasn't been set or we aren't nvim. taken from
+" sensible.vim by Tim Pope, under Vim license; see :help license
+" https://github.com/tpope/vim-sensible/blob/0ce2d843d6f588bb0c8c7eec6449171615dc56d9/plugin/sensible.vim#L57
+if !has('nvim') && maparg('<C-L>', 'n') ==# ''
+ nnoremap <silent> <C-L> :nohlsearch<C-R>=has('diff')?'<Bar>diffupdate':''<CR><CR><C-L>
+endif