"" XDG the vim stuff

"" Set a $MYVIMRC variable in case we want to reference our init file
"" for vim any time in the future.
if empty($MYVIMRC) | let $MYVIMRC = expand('<sfile>:p') | endif

"" Likely unneeded sanity check for XDG_* Vars.  Make sure they exist.
if empty($XDG_CACHE_HOME)  | let $XDG_CACHE_HOME  = $HOME."/.cache"       | endif
if empty($XDG_CONFIG_HOME) | let $XDG_CONFIG_HOME = $HOME."/.config"      | endif
if empty($XDG_DATA_HOME)   | let $XDG_DATA_HOME   = $HOME."/.local/share" | endif

"" Add entries to runtimepath.
set runtimepath^=$XDG_CONFIG_HOME/vim
set runtimepath+=$XDG_DATA_HOME/vim
set runtimepath+=$XDG_CONFIG_HOME/vim/after

"" Set a directory for vim8 build in packages.
set packpath^=$XDG_DATA_HOME/vim,$XDG_CONFIG_HOME/vim
set packpath+=$XDG_CONFIG_HOME/vim/after,$XDG_DATA_HOME/vim/after

"" Give Netrw the same home as vimrc.
let g:netrw_home = $XDG_DATA_HOME."/vim"

"" Make sure there is a /spell directory in an XDG friendly location
"" for vim to find.
call mkdir($XDG_DATA_HOME."/vim/spell", 'p', 0700)

set viewdir=$XDG_DATA_HOME/vim/view      | call mkdir(&viewdir, 'p', 0700)
set undodir=$XDG_CACHE_HOME/vim/undo     | call mkdir(&undodir,   'p', 0700)

"" Neovim has its own location which already complies with XDG specification
if !has('nvim')
  set viminfofile=$XDG_CACHE_HOME/vim/viminfo
endif

"" Source the settings we can share in common with neovim safely.
:source $XDG_CONFIG_HOME/vim/common-vim-settings.vim

"" Prevent initial "Press key to continue" stuff.
set shortmess=a

call plug#begin()

Plug '~/.local/opt/git/git.mgk.one/vim/bourgeoisbear.clrzr'
Plug '~/.local/opt/git/git.mgk.one/tmux/sunaku.tmux-navigate'

call plug#end()

""""
"" Custom Vim-Tmux-Navigator mappings.
""""
""let g:tmux_navigator_no_mappings = 1
""
""nnoremap <silent> <C-a>h :TmuxNavigateLeft<cr>
""nnoremap <silent> <C-a>j :TmuxNavigateDown<cr>
""nnoremap <silent> <C-a>k :TmuxNavigateUp<cr>
""nnoremap <silent> <C-a>l :TmuxNavigateRight<cr>
""nnoremap <silent> <C-a>\ :TmuxNavigatePrevious<cr>

"" Enable termguicolors for clrzr.
set termguicolors

set background=dark
colorscheme solarized
