fixes to qf/loc closing, add pear-tree

This commit is contained in:
Paul Stemmet 2020-10-03 14:48:05 +00:00
parent d4803b6c31
commit 1fe573ad4f
1 changed files with 27 additions and 1 deletions

28
vimrc
View File

@ -85,17 +85,21 @@ endif
exec "set rtp=$VIMHOME," . &rtp
" Better if check for loading plugins
" This one won't cause vim-plug to autodelete 'unloaded' plugins
function! LoadIf(check, ...)
let opts = get(a:000, 0, {})
" Use opts, or default to not loading plugin
return a:check ? opts : extend(opts, { 'on': [], 'for': [] })
endfunction
" Check if we can use async Syntastic
let useNeomake = has('nvim') || v:version > 800
call SourceIfExists(g:rc_files['pre'])
call plug#begin("$VIMHOME/plugged")
Plug 'junegunn/vim-easy-align'
Plug 'tmsvg/pear-tree'
Plug 'tpope/vim-sensible'
Plug 'tpope/vim-fugitive'
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' }
@ -123,6 +127,7 @@ call plug#begin("$VIMHOME/plugged")
Plug 'neoclide/coc.nvim', { 'branch': 'release' }
Plug 'scrooloose/syntastic', LoadIf(!useNeomake)
Plug 'neomake/neomake', LoadIf(useNeomake)
Plug 'romainl/vim-qf', LoadIf(useNeomake)
Plug 'roxma/nvim-yarp', LoadIf(has('nvim'))
Plug 'roxma/vim-hug-neovim-rpc', LoadIf(has('nvim'))
@ -168,14 +173,16 @@ augroup PsoxNERDTree
augroup END
if useNeomake
" Don't move cursor into qf/loc on open
let g:neomake_open_list = 2
" Allow multiple makers to resolve
let g:neomake_serialize = 1
let g:neomake_serialize_abort_on_error = 1
" Run on write (instant) + read (800ms) buffers
call neomake#configure#automake('rw', 800)
" Disable inherited syntastic if it exists
if has_key(plugs, 'syntastic')
" Disable inherited syntastic
let g:syntastic_mode_map = {
\ "mode": "passive",
\ "active_filetypes": [],
@ -183,6 +190,7 @@ if useNeomake
endif
endif
" If we can't use Neomake, fall back to Syntastic
if !useNeomake
" Syntastic Settings
" Note that airline automatically configures these
@ -196,16 +204,34 @@ if !useNeomake
let g:syntastic_enable_bash_checker = 1
endif
" vim-qf
if has_key(plugs, 'vim-qf')
" Don't force qf/loc windows to bottom
let g:qf_window_bottom = 0
let g:qf_loclist_window_bottom = 0
" Let Neomake control window size
if useNeomake
let g:qf_auto_resize = 0
endif
endif
" ripgrep settings
let g:rg_highlight = 'true'
let g:rg_derive_root = 'true'
" Balance pairs when on open, close and delete
let g:pear_tree_smart_openers = 1
let g:pear_tree_smart_closers = 1
let g:pear_tree_smart_backspace = 1
" Other
let g:rainbow_active = 1
augroup PsoxFileAutos
autocmd!
autocmd FileType rust let g:autofmt_autosave = 1
autocmd FileType yaml setlocal indentkeys-=<:> ts=8 sts=2 sw=2 expandtab
autocmd FileType go setlocal ts=8 sts=4 sw=4 noexpandtab
" Tidy nerdtree windiw
autocmd FileType nerdtree setlocal nocursorcolumn nonumber norelativenumber signcolumn=no
autocmd VimEnter *