Skip to content

Commit 63b3fdf

Browse files
committed
Replace coc.nvim with ALE/vim-lsp/etc
So far, using `coc.nvim` and associated plugins wasn't working very well and also wasn't particuarly very ergonomic to work with. This replaces that with ALE (what was used before), adds `vim-lsp` (with `vim-lsp-settings` to make configuration easier) and introduces `asyncomplete` for autocompletion, a setup which seems to work quite well. So far, the only manual setup has been needed for Ruby, where `solargraph` is preferred. https://github.com/dense-analysis/ale https://github.com/prabirshrestha/vim-lsp https://github.com/mattn/vim-lsp-settings https://github.com/prabirshrestha/asyncomplete.vim
1 parent a2f4bfa commit 63b3fdf

File tree

2 files changed

+18
-32
lines changed

2 files changed

+18
-32
lines changed

vimrc

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -108,27 +108,6 @@ let g:ctrlp_use_caching = 0
108108
let g:ctrlp_working_path_mode = 'ra'
109109
let g:ctrlp_switch_buffer = 'et'
110110

111-
""""""""""""
112-
" coc.nvim "
113-
""""""""""""
114-
" use tab to trigger completion and pick the selected
115-
inoremap <silent><expr> <TAB>
116-
\ coc#pum#visible() ? coc#pum#next(1) :
117-
\ CheckBackspace() ? "\<Tab>" :
118-
\ coc#refresh()
119-
inoremap <expr><S-TAB> coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"
120-
121-
inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm()
122-
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
123-
124-
function! CheckBackspace() abort
125-
let col = col('.') - 1
126-
return !col || getline('.')[col - 1] =~# '\s'
127-
endfunction
128-
129-
" format the current file with <leader>p
130-
nmap <leader>p :CocCommand prettier.formatFile<CR>
131-
132111
""""""""""""""""""""
133112
" Filetype Plugins "
134113
""""""""""""""""""""
@@ -167,8 +146,18 @@ let g:pandoc#formatting#mode = 'ha' " enable auto hard wrapping
167146
let g:pandoc#formatting#smart_autoformat_on_cursormoved = 1
168147
let g:pandoc#syntax#conceal#use = 0 " disable conceal
169148

170-
" enable airline with ALE
171-
let g:airline#extensions#ale#enabled = 1
149+
" custom lsp configuration
150+
let g:lsp_settings_filetype_ruby = ['solargraph']
151+
152+
" setup tab complete
153+
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
154+
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
155+
inoremap <expr> <cr> pumvisible() ? asyncomplete#close_popup() : "\<cr>"
156+
157+
let g:airline#extensions#ale#enabled = 1 " set ale to use airline
158+
let g:ale_virtualtext_cursor = 'current' " show error/warning text on current
159+
nmap <silent> <C-[> <Plug>(ale_previous_wrap)
160+
nmap <silent> <C-]> <Plug>(ale_next_wrap)
172161
173162
" vim-test mappings
174163
nnoremap <silent> <Leader>t :TestFile<CR>

vimrc.bundles

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,18 @@ call plug#begin('~/.vim/bundle')
2222

2323
" Define bundles via Github repos
2424
Plug 'airblade/vim-gitgutter'
25-
Plug 'bmatcuk/coc-stylelintplus', {'do': 'yarn install --frozen-lockfile'}
2625
Plug 'bogado/file-line'
2726
Plug 'ctrlpvim/ctrlp.vim'
27+
Plug 'dense-analysis/ale'
2828
Plug 'janko-m/vim-test'
2929
Plug 'jeffkreeftmeijer/vim-dim'
30-
Plug 'neoclide/coc-css', {'do': 'yarn install --frozen-lockfile'}
31-
Plug 'neoclide/coc-eslint', {'do': 'yarn install --frozen-lockfile'}
32-
Plug 'neoclide/coc-html', {'do': 'yarn install --frozen-lockfile'}
33-
Plug 'neoclide/coc-json', {'do': 'yarn install --frozen-lockfile'}
34-
Plug 'neoclide/coc-prettier', {'do': 'yarn install --frozen-lockfile'}
35-
Plug 'neoclide/coc-solargraph', {'do': 'yarn install --frozen-lockfile'}
36-
Plug 'neoclide/coc-tsserver', {'do': 'yarn install --frozen-lockfile'}
37-
Plug 'neoclide/coc.nvim', { 'branch': 'release' }
30+
Plug 'mattn/vim-lsp-settings'
3831
Plug 'pbrisbin/vim-mkdir'
32+
Plug 'prabirshrestha/asyncomplete-lsp.vim'
33+
Plug 'prabirshrestha/asyncomplete.vim'
34+
Plug 'prabirshrestha/vim-lsp'
3935
Plug 'reedes/vim-lexical'
36+
Plug 'rhysd/vim-lsp-ale'
4037
Plug 'ruanyl/vim-gh-line'
4138
Plug 'sbdchd/vim-run'
4239
Plug 'sebdah/vim-delve'

0 commit comments

Comments
 (0)