diff --git a/vim/.vimrc b/vim/.vimrc index 94e067f..ef19926 100644 --- a/vim/.vimrc +++ b/vim/.vimrc @@ -78,21 +78,9 @@ let g:airline#extensions#tabline#enabled = 1 " Close NERDTree if it is the last window " autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif -" Syntastic options -let g:syntastic_always_populate_loc_list = 1 -let g:syntastic_auto_loc_list = 1 -let g:syntastic_check_on_open = 1 -let g:syntastic_check_on_wq = 1 -let g:syntastic_aggregate_errors = 1 -let g:syntastic_go_checkers = ['golint', 'govet', 'errcheck'] -" let g:syntastic_mode_map = { 'mode': 'active', 'passive_filetypes': ['go'] } -let g:syntastic_javascript_checkers = ['eslint'] -let g:syntastic_java_javac_config_file_enabled = 1 - " Vim-go options let g:go_fmt_command = "goimports" let g:go_fmt_autosave = 1 -let g:go_metalinter_command = "golangci-lint" let g:go_metalinter_enabled = ['govet', 'golint', 'errcheck', 'staticcheck', 'gosimple', 'structcheck', 'varcheck', 'ineffassign', 'deadcode', 'gosec', 'unconvert', 'dupl', 'goconst', 'gocyclo', 'misspell', 'unparam', 'lll', 'interfacer', 'nakedret', 'scopelint'] let g:go_metalinter_autosave = 1 "let g:go_metalinter_autosave_enabled = ['govet', 'golint', 'errcheck'] @@ -113,22 +101,17 @@ let g:go_highlight_chan_whitespace_error = 1 let g:go_highlight_space_tab_error = 1 let g:go_highlight_trailing_whitespace_error = 1 let g:go_highlight_variable_declarations = 1 -let g:go_info_mode = 'gopls' +let g:go_doc_popup_window=1 +let g:go_def_mapping_enabled = 0 +let g:go_doc_keywordprg_enabled = 0 +let g:go_code_completion_enabled = 0 +let g:go_gopls_use_placeholders = 1 +let g:go_gopls_complete_unimported = 1 let g:go_test_show_name = 1 let g:go_test_timeout= '60s' let g:go_auto_type_info = 1 let g:go_jump_to_error = 0 -if has("autocmd") - autocmd FileType go nmap b (go-build) - autocmd FileType go nmap r (go-run) - autocmd FileType go nmap t (go-test) - autocmd FileType go nmap T (go-test-func) - autocmd FileType go nmap c (go-coverage-toggle) - autocmd FileType go nmap a (go-alternate-edit) - autocmd FileType go nmap f (go-fmt) - autocmd FileType go nmap d (go-def) - autocmd FileType go nmap m (go-metalinter) -endif +let g:go_auto_sameids = 0 " vimwiki options let g:vimwiki_list = [{'path': '~/Notebook/work', @@ -151,6 +134,12 @@ let g:indent_guides_auto_colors = 0 autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd ctermbg=none autocmd VimEnter,Colorscheme * :hi IndentGuidesEven ctermbg=black +" CoC options + +" ALE options +let g:ale_completion_enabled = 0 +let g:ale_fix_on_save = 0 + call plug#begin('~/.vim/plugged') Plug 'scrooloose/nerdtree' @@ -170,11 +159,10 @@ call plug#begin('~/.vim/plugged') Plug 'mattn/emmet-vim' Plug 'ollykel/v-vim' - Plug 'scrooloose/syntastic' - Plug 'mtscout6/syntastic-local-eslint.vim' - Plug 'kien/ctrlp.vim' Plug 'liuchengxu/vim-clap' - Plug 'valloric/youcompleteme' + Plug 'neoclide/coc.nvim', {'branch': 'release'} + Plug 'dense-analysis/ale' + Plug 'joereynolds/vim-minisnip' Plug 'aklt/plantuml-syntax' Plug 'scrooloose/vim-slumlord' @@ -196,3 +184,36 @@ nnoremap h :cclose nnoremap s :keeppattern %s/\s\+$// autocmd BufNewFile,BufRead *.tmpl set syntax=gohtmltmpl + +nmap gd (coc-definition) +nmap gy (coc-type-definition) +nmap gi (coc-implementation) +nmap gr (coc-references) +nmap go (coc-list-outline) + +nnoremap K :call show_documentation() +nmap rn (coc-rename) + +function! s:show_documentation() + if (index(['vim','help'], &filetype) >= 0) + execute 'h '.expand('') + else + call CocAction('doHover') + endif +endfunction + +nmap :Clap files +nmap b :Clap buffers + +if has("autocmd") + autocmd FileType go nmap b (go-build) + autocmd FileType go nmap r (go-run) + autocmd FileType go nmap t (go-test) + autocmd FileType go nmap T (go-test-func) + autocmd FileType go nmap c (go-coverage) + autocmd FileType go nmap cc (go-coverage-clean) + autocmd FileType go nmap a (go-alternate-edit) + autocmd FileType go nmap f (go-fmt) + autocmd FileType go nmap d (go-def) + autocmd FileType go nmap m (go-metalinter) +endif