From d4803b6c3166f1709b27afe87b2cc3c462d5ae77 Mon Sep 17 00:00:00 2001 From: Bazaah Date: Thu, 1 Oct 2020 13:23:04 +0000 Subject: [PATCH 1/6] initial integration with neomake --- vimrc | 66 ++++++++++++++++++++++++++++++++++++++--------------------- zshrc | 2 +- 2 files changed, 44 insertions(+), 24 deletions(-) diff --git a/vimrc b/vimrc index 74c324d..c990420 100644 --- a/vimrc +++ b/vimrc @@ -85,7 +85,13 @@ endif exec "set rtp=$VIMHOME," . &rtp -" (Optional) Multi-entry selection UI. +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 + +let useNeomake = has('nvim') || v:version > 800 call SourceIfExists(g:rc_files['pre']) call plug#begin("$VIMHOME/plugged") @@ -94,7 +100,6 @@ call plug#begin("$VIMHOME/plugged") Plug 'tpope/vim-fugitive' Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } Plug 'Xuyuanp/nerdtree-git-plugin', { 'on': 'NERDTreeToggle' } - Plug 'scrooloose/syntastic' Plug 'scrooloose/nerdcommenter' Plug 'scrooloose/vim-statline' Plug 'vim-perl/vim-perl', { 'for': 'perl', 'do': 'make clean carp dancer highlight-all-pragmas moose test-more try-tiny' } @@ -104,7 +109,7 @@ call plug#begin("$VIMHOME/plugged") Plug 'kevinoid/vim-jsonc' Plug 'jremmen/vim-ripgrep', { 'on': ['Rg', 'RgRoot'] } Plug 'junegunn/fzf', { 'on': ['FZF', 'fzf#run', 'fzf#wrap'] } - Plug 'junegunn/fzf.vim' + Plug 'junegunn/fzf.vim', Plug 'sheerun/vim-polyglot' Plug 'adelarsq/vim-matchit' Plug 'vim-airline/vim-airline' @@ -112,16 +117,17 @@ call plug#begin("$VIMHOME/plugged") Plug 'airblade/vim-gitgutter' Plug 'rakr/vim-one' Plug 'mox-mox/vim-localsearch' - Plug 'neoclide/coc.nvim', { 'branch': 'release' } Plug 'romainl/vim-cool' Plug 'christoomey/vim-tmux-navigator', { 'on': ['TmuxNavigateLeft', 'TmuxNavigateDown', 'TmuxNavigateUp', 'TmuxNavigateRight', 'TmuxNavigatePrevious'] } - call SourceIfExists(g:rc_files['plug']) - if has('nvim') - Plug 'roxma/nvim-yarp' - Plug 'roxma/vim-hug-neovim-rpc' - endif -call plug#end() + Plug 'neoclide/coc.nvim', { 'branch': 'release' } + Plug 'scrooloose/syntastic', LoadIf(!useNeomake) + Plug 'neomake/neomake', LoadIf(useNeomake) + + Plug 'roxma/nvim-yarp', LoadIf(has('nvim')) + Plug 'roxma/vim-hug-neovim-rpc', LoadIf(has('nvim')) + call SourceIfExists(g:rc_files['plug']) +call plug#end() call SourceIfExists(g:rc_files['post']) execute ':silent !mkdir -p ~/.vimbackup' @@ -161,17 +167,34 @@ augroup PsoxNERDTree autocmd VimEnter * if argc() == 1 && isdirectory(argv()[0]) && !exists("s:std_in") | exe 'NERDTree' argv()[0] | wincmd p | ene | exe 'cd '.argv()[0] | endif augroup END +if useNeomake + let g:neomake_open_list = 2 + 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) -" Syntastic Settings -" Note that airline automatically configures these -let g:syntastic_always_populate_loc_list = 1 -let g:syntastic_enable_signs = 1 -let g:syntastic_auto_loc_list = 1 -let g:syntastic_check_on_open = 1 -let g:syntastic_check_on_wq = 0 -" Syntastic enable specific checkers -let g:syntastic_enable_zsh_checker = 1 -let g:syntastic_enable_bash_checker = 1 + if has_key(plugs, 'syntastic') + " Disable inherited syntastic + let g:syntastic_mode_map = { + \ "mode": "passive", + \ "active_filetypes": [], + \ "passive_filetypes": [] } + endif +endif + +if !useNeomake + " Syntastic Settings + " Note that airline automatically configures these + let g:syntastic_always_populate_loc_list = 1 + let g:syntastic_enable_signs = 1 + let g:syntastic_auto_loc_list = 1 + let g:syntastic_check_on_open = 1 + let g:syntastic_check_on_wq = 0 + " Syntastic enable specific checkers + let g:syntastic_enable_zsh_checker = 1 + let g:syntastic_enable_bash_checker = 1 +endif " ripgrep settings let g:rg_highlight = 'true' @@ -271,9 +294,6 @@ endif " NERDTree Toggle nnoremap :NERDTreeToggle -" NERDComment settings -" nnoremap :call NERDComment('n', 'toggle') - " Workaround for writing readonly files cnoremap w!! w !sudo tee % > /dev/null diff --git a/zshrc b/zshrc index 2a99fc8..cd105fc 100755 --- a/zshrc +++ b/zshrc @@ -114,7 +114,7 @@ plugins=( common-aliases colored-man-pages ) -( which git &>/dev/null ) && plugins+=( git git-extras git-flow-avh ) && [[ "$ZSH_THEME" == "stemmet" ]] && plugins+=( git-prompt ) +( which git &>/dev/null ) && plugins+=( git git-extras git-flow-avh ) #&& [[ "$ZSH_THEME" == "stemmet" ]] && plugins+=( git-prompt ) ( which perl &>/dev/null ) && plugins+=( perl ) ( which go &>/dev/null ) && plugins+=( golang ) ( which oc &>/dev/null ) && plugins+=( oc ) From 1fe573ad4fff5a82b4fe9ee3ca3c000e5d66945b Mon Sep 17 00:00:00 2001 From: Bazaah Date: Sat, 3 Oct 2020 14:48:05 +0000 Subject: [PATCH 2/6] fixes to qf/loc closing, add pear-tree --- vimrc | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/vimrc b/vimrc index c990420..97fee12 100644 --- a/vimrc +++ b/vimrc @@ -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 * From 4d1daa555244ac00ba7289b020e749f3292c0adf Mon Sep 17 00:00:00 2001 From: Bazaah Date: Sat, 3 Oct 2020 15:34:22 +0000 Subject: [PATCH 3/6] add go autocmds --- vimrc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vimrc b/vimrc index 97fee12..eec4a1a 100644 --- a/vimrc +++ b/vimrc @@ -231,9 +231,11 @@ 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 + autocmd FileType go setlocal ts=8 sts=4 sw=4 noexpandtab + \| autocmd BufWritePre silent %!gofmt " Tidy nerdtree windiw autocmd FileType nerdtree setlocal nocursorcolumn nonumber norelativenumber signcolumn=no + " Autoinstall absent plugins autocmd VimEnter * \ if len(filter(values(g:plugs), '!isdirectory(v:val.dir)')) \| PlugInstall --sync From 94354e9286f8aece3433b5908a9d415ffa72aae6 Mon Sep 17 00:00:00 2001 From: Bazaah Date: Sat, 3 Oct 2020 15:50:54 +0000 Subject: [PATCH 4/6] make starship happy --- zshrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zshrc b/zshrc index cd105fc..ea47504 100755 --- a/zshrc +++ b/zshrc @@ -114,7 +114,7 @@ plugins=( common-aliases colored-man-pages ) -( which git &>/dev/null ) && plugins+=( git git-extras git-flow-avh ) #&& [[ "$ZSH_THEME" == "stemmet" ]] && plugins+=( git-prompt ) +( which git &>/dev/null ) && plugins+=( git git-extras git-flow-avh ) && [[ "$ZSH_THEME" == "stemmet" ]] && [ -z "$STARSHIP_SHELL" ] && plugins+=( git-prompt ) ( which perl &>/dev/null ) && plugins+=( perl ) ( which go &>/dev/null ) && plugins+=( golang ) ( which oc &>/dev/null ) && plugins+=( oc ) From 1c56259ad3ada665e4db1e783cce86f884f2f35a Mon Sep 17 00:00:00 2001 From: Bazaah Date: Sat, 3 Oct 2020 16:02:30 +0000 Subject: [PATCH 5/6] fix type --- vimrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vimrc b/vimrc index eec4a1a..21916fc 100644 --- a/vimrc +++ b/vimrc @@ -113,7 +113,7 @@ call plug#begin("$VIMHOME/plugged") Plug 'kevinoid/vim-jsonc' Plug 'jremmen/vim-ripgrep', { 'on': ['Rg', 'RgRoot'] } Plug 'junegunn/fzf', { 'on': ['FZF', 'fzf#run', 'fzf#wrap'] } - Plug 'junegunn/fzf.vim', + Plug 'junegunn/fzf.vim' Plug 'sheerun/vim-polyglot' Plug 'adelarsq/vim-matchit' Plug 'vim-airline/vim-airline' From a67e9cf35920ac58cb6cf7113a7fd040b92db26e Mon Sep 17 00:00:00 2001 From: psox Date: Thu, 29 Oct 2020 10:26:36 +0000 Subject: [PATCH 6/6] remove unwanted aliases --- zshrc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/zshrc b/zshrc index ea47504..15ef60b 100755 --- a/zshrc +++ b/zshrc @@ -281,6 +281,10 @@ precmd() { fi } +# Remove unwanted aliases + +( where fd | grep -E '\/s?bin\/fd' ) && alias fd &>/dev/null && unalias fd + # Clean up global aliases source <(alias -g | awk -F= '/^[A-Za-z]+/{print $1}' | xargs -I{} -n1 echo unalias "'{}'")