coc-nvim replaced vim-lsp

This commit is contained in:
ManjaroOne666 2018-11-25 17:55:50 +00:00
parent 690acc8ed0
commit a35c2177c5
3 changed files with 103 additions and 70 deletions

View File

@ -1,6 +1,13 @@
{ {
"coc.preferences.triggerAfterInsertEnter": true, "coc.preferences.triggerAfterInsertEnter": false,
"coc.preferences.autoTrigger": "always", "coc.preferences.autoTrigger": "none",
"coc.preferences.timeout": 200 "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
} }

View File

@ -281,11 +281,11 @@
[ "SpellRare", "NONE", fg_spellrare, "NONE", fg_spellcap ], [ "SpellRare", "NONE", fg_spellrare, "NONE", fg_spellcap ],
[ "WildMenu", ui_bg, ui_fg_strong4, "bold" ], [ "WildMenu", ui_bg, ui_fg_strong4, "bold" ],
[ "ErrorMsg", "NONE", ui_fg_errormsg, "bold" ], [ "ErrorMsg", "NONE", ui_fg_errormsg, "italic" ],
[ "ModeMsg", "NONE", ui_fg_strong4, "bold" ], [ "ModeMsg", "NONE", ui_fg_strong4, "italic" ],
[ "MoreMsg", "NONE", ui_fg_strong4, "NONE" ], [ "MoreMsg", "NONE", ui_fg_strong4, "italic" ],
[ "Question", "NONE", ui_fg_question, "NONE" ], [ "Question", "NONE", ui_fg_question, "italic" ],
[ "WarningMsg", "NONE", ui_fg_warningmsg, "bold" ], [ "WarningMsg", "NONE", ui_fg_warningmsg, "italic" ],
[ "Cursor", ui_cursor_bg, ui_cursor_fg, "bold" ], [ "Cursor", ui_cursor_bg, ui_cursor_fg, "bold" ],
[ "CursorColumn", bg_cursorcolumn, "NONE", "NONE" ], [ "CursorColumn", bg_cursorcolumn, "NONE", "NONE" ],
@ -594,12 +594,16 @@
# plugins # plugins
[ "CocErrorSign", "ErrorMsg" ],
[ "CocWarningSign", "WarningMsg" ],
[ "CocInfoSign", "Question" ],
[ "CocHintSign", "Question" ],
[ "LspErrorText", "ErrorMsg" ], [ "LspErrorText", "ErrorMsg" ],
[ "LspWarningText", "WarningMsg" ], [ "LspWarningText", "WarningMsg" ],
[ "LspInformationText", "Question" ], [ "LspInformationText", "Question" ],
[ "LspHintText", "Question" ], [ "LspHintText", "Question" ],
[ "ALEErrorSign", "ErrorMsg" ], [ "ALEErrorSign", "ErrorMsg" ],
[ "ALEWarningSign", "ErrorMsg" ], [ "ALEWarningSign", "WarningMsg" ],
# ctrl-p highlighting # ctrl-p highlighting
# :h ctrlp-customization # :h ctrlp-customization

144
vimrc
View File

@ -10,28 +10,51 @@ endif
if !has('nvim') if !has('nvim')
call plug#begin('~/.vim/bundle') 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 = '<tab>'
let g:coc_snippet_prev = '<s-tab>'
inoremap <silent><expr> <c-n> coc#refresh()
nnoremap <silent> K :call <SID>show_documentation()<CR>
nmap <silent> \d <Plug>(coc-definition)
nmap <silent> \y <Plug>(coc-type-definition)
nmap <silent> \i <Plug>(coc-implementation)
nmap <silent> \r <Plug>(coc-references)
nmap \n <Plug>(coc-rename)
vmap \f <Plug>(coc-format-selected)
nmap \f <Plug>(coc-format-selected)
command! -nargs=0 Format :call CocAction('format')
command! -nargs=? Fold :call CocAction('fold', <f-args>)
" augroup coc_augroup
" autocmd!
" autocmd CursorHold * silent call CocActionAsync('highlight')
" augroup END
function! s:show_documentation()
if &filetype == 'vim' || &filetype == 'help'
execute 'h '.expand('<cword>')
else
call CocAction('doHover')
endif
endfunction
"}}}
" #ALE {{{ " #ALE {{{
" https://github.com/w0rp/ale " https://github.com/w0rp/ale
Plug 'w0rp/ale' Plug 'w0rp/ale'
nnoremap <space>ne :lnext<cr>
nnoremap <space>pe :lprev<cr>
let g:ale_sign_error = '>>'
let g:ale_sign_warning = '>'
let g:ale_sign_column_always = 1 let g:ale_sign_column_always = 1
let g:ale_open_list = 0 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_html_htmlhint_options = '-c ~/.htmlhintrc --format=unix'
let g:ale_fixers = {'javascript': ['eslint']} let g:ale_fixers = {'javascript': ['eslint']}
let g:ale_sign_error = '▷' let g:ale_sign_error = 'Α'
let g:ale_sign_warning = '▷' let g:ale_sign_warning = 'α'
"}}}
" #coc.nvim{{{
" https://github.com/neoclide/coc.nvim
" Plug 'neoclide/coc.nvim', {'tag': '*', 'do': { -> coc#util#install()}}
"}}} "}}}
" #colorV {{{ " #colorV {{{
" original: " original:
@ -357,53 +380,53 @@ let g:mta_filetypes = {
"}}} "}}}
" #vim-lsp {{{ " #vim-lsp {{{
" https://github.com/prabirshrestha/vim-lsp " https://github.com/prabirshrestha/vim-lsp
Plug 'prabirshrestha/async.vim' " Plug 'prabirshrestha/async.vim'
Plug 'prabirshrestha/vim-lsp' " Plug 'prabirshrestha/vim-lsp'
"
let g:lsp_signs_enabled = 1 " let g:lsp_signs_enabled = 1
let g:lsp_signs_error = {'text': '▶'} " let g:lsp_signs_error = {'text': '▶'}
let g:lsp_signs_warning = {'text': '▶'} " let g:lsp_signs_warning = {'text': '▶'}
let g:lsp_signs_information = {'text': '◆'} " let g:lsp_signs_information = {'text': '◆'}
let g:lsp_signs_hint = {'text': '◆'} " let g:lsp_signs_hint = {'text': '◆'}
let g:lsp_diagnostics_echo_cursor = 1 " let g:lsp_diagnostics_echo_cursor = 1
let g:lsp_diagnostics_echo_delay = 0 " let g:lsp_diagnostics_echo_delay = 0
nnoremap \l :cclose<CR>:LspDocumentDiagnostics<cr> " nnoremap \l :cclose<CR>:LspDocumentDiagnostics<cr>
nnoremap \h :LspHover<cr> " nnoremap \h :LspHover<cr>
nnoremap \d :LspDefinition<cr> " nnoremap \d :LspDefinition<cr>
nnoremap \r :LspReferences<cr> " nnoremap \r :LspReferences<cr>
nnoremap \n :LspRename<cr> " nnoremap \n :LspRename<cr>
nnoremap \s :LspDocumentSymbol<cr> " nnoremap \s :LspDocumentSymbol<cr>
nnoremap \w :LspWorkspaceSymbol<cr> " nnoremap \w :LspWorkspaceSymbol<cr>
nnoremap \ff :LspDocumentFormat<cr> " nnoremap \ff :LspDocumentFormat<cr>
nnoremap \fr :LspDocumentRangeFormat<cr> " nnoremap \fr :LspDocumentRangeFormat<cr>
augroup User lsp_setup " augroup User lsp_setup
autocmd! " autocmd!
if executable('vls') "{{{ " if executable('vls') "{{{
autocmd User lsp_setup call lsp#register_server({ " autocmd User lsp_setup call lsp#register_server({
\ 'name': 'vue', " \ 'name': 'vue',
\ 'cmd': {server_info->['vls']}, " \ 'cmd': {server_info->['vls']},
\ 'whitelist': ['vue'], " \ 'whitelist': ['vue'],
\ }) " \ })
endif " endif
"}}} " "}}}
if executable('pyls') "{{{ " if executable('pyls') "{{{
autocmd User lsp_setup call lsp#register_server({ " autocmd User lsp_setup call lsp#register_server({
\ 'name': 'pyls', " \ 'name': 'pyls',
\ 'cmd': {server_info->['pyls']}, " \ 'cmd': {server_info->['pyls']},
\ 'whitelist': ['python'], " \ 'whitelist': ['python'],
\ }) " \ })
endif " endif
"}}} " "}}}
if executable('typescript-language-server') "{{{ " if executable('typescript-language-server') "{{{
au User lsp_setup call lsp#register_server({ " au User lsp_setup call lsp#register_server({
\ 'name': 'typescript-language-server', " \ 'name': 'typescript-language-server',
\ 'cmd': { server_info->[&shell, &shellcmdflag, 'typescript-language-server --stdio']}, " \ '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/..'))}, " \ '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'] " \ 'whitelist': ['typescript', 'javascript', 'javascript.jsx']
\ }) " \ })
endif " endif
"}}} " "}}}
augroup END " augroup END
""}}} ""}}}
" #vim-repeat{{{ " #vim-repeat{{{
@ -948,8 +971,7 @@ set hlsearch
" set previewheight=24 " set previewheight=24
" set splitbelow " set splitbelow
set completeopt=longest,menuone set completeopt=longest,menuone,preview
set completeopt-=preview
set nospell set nospell
set spelllang=en_gb set spelllang=en_gb