try
  colorscheme unokai
catch /^Vim\%((\a\+)\)\=:E185/
  colorscheme monokai
endtry
nnoremap ,rc :source $MYVIMRC<CR>

autocmd FileType make setlocal noexpandtab
autocmd FileType yaml setlocal tabstop=2
let g:rustfmt_autosave = 0
let g:netrw_banner = 0
nnoremap ,cD :call setqflist(filter(getqflist(), 'v:val != getqflist()[getqflist({"idx": 0}).idx - 1]'))<CR>
nnoremap ,cc :cclose<CR>
nnoremap ,cf :cfirst<CR>
nnoremap ,cl :clast<CR>
nnoremap ,co :copen<CR>
nnoremap ,cq :call setqflist([])<CR>:cclose<CR>
nnoremap ,cr :cnewer<CR>
nnoremap ,cu :colder<CR>

nnoremap ,h H
nnoremap ,l L
nnoremap ,t <c-w>v<c-w>l:terminal<CR>a
nnoremap ,rl :checktime<CR>
nnoremap <c-d> <c-d>zz
nnoremap <c-h> <c-w>h
nnoremap <c-j> <c-w>j
nnoremap <c-k> <c-w>k
nnoremap <c-l> <c-w>l
nnoremap <c-n> :cnext<CR>
nnoremap <c-p> :cprevious<CR>
nnoremap <c-u> <c-u>zz
nnoremap H ^
nnoremap L $

" i use ctrl-a for the tmux prefix key
nnoremap <C-a> <Nop>
nnoremap <C-x> <Nop>
nnoremap ,a <C-a>
nnoremap ,x <C-x>

set autowriteall
set autoindent
set cursorline

set expandtab
set exrc
set guicursor=n-v-c:block-Cursor
set incsearch
set nohlsearch
set nowrap
set nu
set path=**
set rnu
set secure
set shiftround
set shiftwidth=0
set tabstop=4
set ttimeoutlen=50
set viewoptions=folds,cursor
set wildignore=*.o,*.obj,.git/**,tags,*.pyc
set noswapfile
set makeprg=just
syntax on
tnoremap <silent> <c-w>c <c-\><c-n><c-w>c
xnoremap <silent> H ^
xnoremap <silent> L $
nnoremap <silent> Q @@
nnoremap <silent> ,m :make<CR>
nnoremap <silent> - :E<CR>
nnoremap <silent> _ :execute 'Explore ' . fnameescape(getcwd())<CR>

if has('clipboard')
  set clipboard^=unnamed,unnamedplus
endif

au BufEnter *__virtual* setlocal buftype=nofile bufhidden=hide noswapfile
au BufNewFile,BufRead *.h set filetype=c
au BufWinEnter *.* silent! loadview 
au BufWinLeave *.* silent! mkview 
au FileType * setlocal indentexpr=
au FileType lua setlocal noexpandtab
au FileType c setlocal noexpandtab
