coc-nvim replaced vim-lsp
This commit is contained in:
parent
690acc8ed0
commit
a35c2177c5
3 changed files with 103 additions and 70 deletions
144
vimrc
144
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 = '<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 {{{
|
||||
" https://github.com/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_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<CR>:LspDocumentDiagnostics<cr>
|
||||
nnoremap \h :LspHover<cr>
|
||||
nnoremap \d :LspDefinition<cr>
|
||||
nnoremap \r :LspReferences<cr>
|
||||
nnoremap \n :LspRename<cr>
|
||||
nnoremap \s :LspDocumentSymbol<cr>
|
||||
nnoremap \w :LspWorkspaceSymbol<cr>
|
||||
nnoremap \ff :LspDocumentFormat<cr>
|
||||
nnoremap \fr :LspDocumentRangeFormat<cr>
|
||||
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<CR>:LspDocumentDiagnostics<cr>
|
||||
" nnoremap \h :LspHover<cr>
|
||||
" nnoremap \d :LspDefinition<cr>
|
||||
" nnoremap \r :LspReferences<cr>
|
||||
" nnoremap \n :LspRename<cr>
|
||||
" nnoremap \s :LspDocumentSymbol<cr>
|
||||
" nnoremap \w :LspWorkspaceSymbol<cr>
|
||||
" nnoremap \ff :LspDocumentFormat<cr>
|
||||
" nnoremap \fr :LspDocumentRangeFormat<cr>
|
||||
" 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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue