From a35c2177c577e5d443282740f9e0e0c679df6daa Mon Sep 17 00:00:00 2001 From: ManjaroOne666 Date: Sun, 25 Nov 2018 17:55:50 +0000 Subject: [PATCH] coc-nvim replaced vim-lsp --- vim/coc-settings.json | 13 ++- vim/colors/monotonous-dark.erb | 16 ++-- vimrc | 144 +++++++++++++++++++-------------- 3 files changed, 103 insertions(+), 70 deletions(-) diff --git a/vim/coc-settings.json b/vim/coc-settings.json index 0511d43..347951c 100644 --- a/vim/coc-settings.json +++ b/vim/coc-settings.json @@ -1,6 +1,13 @@ { - "coc.preferences.triggerAfterInsertEnter": true, - "coc.preferences.autoTrigger": "always", - "coc.preferences.timeout": 200 + "coc.preferences.triggerAfterInsertEnter": false, + "coc.preferences.autoTrigger": "none", + "coc.preferences.triggerSignatureHelp": true, + "coc.preferences.diagnostic.warningSign": "λ", + "coc.preferences.diagnostic.errorSign": "Λ", + "coc.preferences.diagnostic.infoSign": "λ", + "coc.preferences.diagnostic.hintSign": "λ", + "coc.preferences.timeout": 200, + + "coc.source.buffer.ignoreGitignore": true } diff --git a/vim/colors/monotonous-dark.erb b/vim/colors/monotonous-dark.erb index 80d5af0..cae5652 100644 --- a/vim/colors/monotonous-dark.erb +++ b/vim/colors/monotonous-dark.erb @@ -281,11 +281,11 @@ [ "SpellRare", "NONE", fg_spellrare, "NONE", fg_spellcap ], [ "WildMenu", ui_bg, ui_fg_strong4, "bold" ], - [ "ErrorMsg", "NONE", ui_fg_errormsg, "bold" ], - [ "ModeMsg", "NONE", ui_fg_strong4, "bold" ], - [ "MoreMsg", "NONE", ui_fg_strong4, "NONE" ], - [ "Question", "NONE", ui_fg_question, "NONE" ], - [ "WarningMsg", "NONE", ui_fg_warningmsg, "bold" ], + [ "ErrorMsg", "NONE", ui_fg_errormsg, "italic" ], + [ "ModeMsg", "NONE", ui_fg_strong4, "italic" ], + [ "MoreMsg", "NONE", ui_fg_strong4, "italic" ], + [ "Question", "NONE", ui_fg_question, "italic" ], + [ "WarningMsg", "NONE", ui_fg_warningmsg, "italic" ], [ "Cursor", ui_cursor_bg, ui_cursor_fg, "bold" ], [ "CursorColumn", bg_cursorcolumn, "NONE", "NONE" ], @@ -594,12 +594,16 @@ # plugins + [ "CocErrorSign", "ErrorMsg" ], + [ "CocWarningSign", "WarningMsg" ], + [ "CocInfoSign", "Question" ], + [ "CocHintSign", "Question" ], [ "LspErrorText", "ErrorMsg" ], [ "LspWarningText", "WarningMsg" ], [ "LspInformationText", "Question" ], [ "LspHintText", "Question" ], [ "ALEErrorSign", "ErrorMsg" ], - [ "ALEWarningSign", "ErrorMsg" ], + [ "ALEWarningSign", "WarningMsg" ], # ctrl-p highlighting # :h ctrlp-customization diff --git a/vimrc b/vimrc index 4f5b7ea..e0dd8a1 100644 --- a/vimrc +++ b/vimrc @@ -10,28 +10,51 @@ endif if !has('nvim') call plug#begin('~/.vim/bundle') +" #coc.nvim{{{ + " https://github.com/neoclide/coc.nvim + Plug 'neoclide/coc.nvim', {'tag': '*', 'do': { -> coc#util#install()}} + + let g:coc_snippet_next = '' + let g:coc_snippet_prev = '' + + inoremap coc#refresh() + nnoremap K :call show_documentation() + nmap \d (coc-definition) + nmap \y (coc-type-definition) + nmap \i (coc-implementation) + nmap \r (coc-references) + nmap \n (coc-rename) + vmap \f (coc-format-selected) + nmap \f (coc-format-selected) + command! -nargs=0 Format :call CocAction('format') + command! -nargs=? Fold :call CocAction('fold', ) + " augroup coc_augroup + " autocmd! + " autocmd CursorHold * silent call CocActionAsync('highlight') + " augroup END + + function! s:show_documentation() + if &filetype == 'vim' || &filetype == 'help' + execute 'h '.expand('') + else + call CocAction('doHover') + endif + endfunction + "}}} + " #ALE {{{ " https://github.com/w0rp/ale Plug 'w0rp/ale' - nnoremap ne :lnext - nnoremap pe :lprev - - let g:ale_sign_error = '>>' - let g:ale_sign_warning = '>' let g:ale_sign_column_always = 1 let g:ale_open_list = 0 - let g:ale_linters = {'scss': ['stylelint'], 'javascript': [], 'php':['php'], 'html':['htmlhint'], 'python': [], 'vue': []} + " let g:ale_linters = {'scss': ['stylelint'], 'javascript': [], 'php':['php'], 'html':['htmlhint'], 'python': [], 'vue': []} let g:ale_html_htmlhint_options = '-c ~/.htmlhintrc --format=unix' let g:ale_fixers = {'javascript': ['eslint']} - let g:ale_sign_error = '▷' - let g:ale_sign_warning = '▷' + let g:ale_sign_error = 'Α' + let g:ale_sign_warning = 'α' - "}}} -" #coc.nvim{{{ - " https://github.com/neoclide/coc.nvim - " Plug 'neoclide/coc.nvim', {'tag': '*', 'do': { -> coc#util#install()}} "}}} " #colorV {{{ " original: @@ -357,53 +380,53 @@ let g:mta_filetypes = { "}}} " #vim-lsp {{{ " https://github.com/prabirshrestha/vim-lsp - Plug 'prabirshrestha/async.vim' - Plug 'prabirshrestha/vim-lsp' - - let g:lsp_signs_enabled = 1 - let g:lsp_signs_error = {'text': '▶'} - let g:lsp_signs_warning = {'text': '▶'} - let g:lsp_signs_information = {'text': '◆'} - let g:lsp_signs_hint = {'text': '◆'} - let g:lsp_diagnostics_echo_cursor = 1 - let g:lsp_diagnostics_echo_delay = 0 - nnoremap \l :cclose:LspDocumentDiagnostics - nnoremap \h :LspHover - nnoremap \d :LspDefinition - nnoremap \r :LspReferences - nnoremap \n :LspRename - nnoremap \s :LspDocumentSymbol - nnoremap \w :LspWorkspaceSymbol - nnoremap \ff :LspDocumentFormat - nnoremap \fr :LspDocumentRangeFormat - augroup User lsp_setup - autocmd! - if executable('vls') "{{{ - autocmd User lsp_setup call lsp#register_server({ - \ 'name': 'vue', - \ 'cmd': {server_info->['vls']}, - \ 'whitelist': ['vue'], - \ }) - endif - "}}} - if executable('pyls') "{{{ - autocmd User lsp_setup call lsp#register_server({ - \ 'name': 'pyls', - \ 'cmd': {server_info->['pyls']}, - \ 'whitelist': ['python'], - \ }) - endif - "}}} - if executable('typescript-language-server') "{{{ - au User lsp_setup call lsp#register_server({ - \ 'name': 'typescript-language-server', - \ 'cmd': { server_info->[&shell, &shellcmdflag, 'typescript-language-server --stdio']}, - \ 'root_uri': { server_info->lsp#utils#path_to_uri(lsp#utils#find_nearest_parent_directory(lsp#utils#get_buffer_path(), '.git/..'))}, - \ 'whitelist': ['typescript', 'javascript', 'javascript.jsx'] - \ }) - endif - "}}} - augroup END + " Plug 'prabirshrestha/async.vim' + " Plug 'prabirshrestha/vim-lsp' + " + " let g:lsp_signs_enabled = 1 + " let g:lsp_signs_error = {'text': '▶'} + " let g:lsp_signs_warning = {'text': '▶'} + " let g:lsp_signs_information = {'text': '◆'} + " let g:lsp_signs_hint = {'text': '◆'} + " let g:lsp_diagnostics_echo_cursor = 1 + " let g:lsp_diagnostics_echo_delay = 0 + " nnoremap \l :cclose:LspDocumentDiagnostics + " nnoremap \h :LspHover + " nnoremap \d :LspDefinition + " nnoremap \r :LspReferences + " nnoremap \n :LspRename + " nnoremap \s :LspDocumentSymbol + " nnoremap \w :LspWorkspaceSymbol + " nnoremap \ff :LspDocumentFormat + " nnoremap \fr :LspDocumentRangeFormat + " augroup User lsp_setup + " autocmd! + " if executable('vls') "{{{ + " autocmd User lsp_setup call lsp#register_server({ + " \ 'name': 'vue', + " \ 'cmd': {server_info->['vls']}, + " \ 'whitelist': ['vue'], + " \ }) + " endif + " "}}} + " if executable('pyls') "{{{ + " autocmd User lsp_setup call lsp#register_server({ + " \ 'name': 'pyls', + " \ 'cmd': {server_info->['pyls']}, + " \ 'whitelist': ['python'], + " \ }) + " endif + " "}}} + " if executable('typescript-language-server') "{{{ + " au User lsp_setup call lsp#register_server({ + " \ 'name': 'typescript-language-server', + " \ 'cmd': { server_info->[&shell, &shellcmdflag, 'typescript-language-server --stdio']}, + " \ 'root_uri': { server_info->lsp#utils#path_to_uri(lsp#utils#find_nearest_parent_directory(lsp#utils#get_buffer_path(), '.git/..'))}, + " \ 'whitelist': ['typescript', 'javascript', 'javascript.jsx'] + " \ }) + " endif + " "}}} + " augroup END ""}}} " #vim-repeat{{{ @@ -948,8 +971,7 @@ set hlsearch " set previewheight=24 " set splitbelow -set completeopt=longest,menuone -set completeopt-=preview +set completeopt=longest,menuone,preview set nospell set spelllang=en_gb