Use vim-lsp instead of ale
This commit is contained in:
17
ale.vim
17
ale.vim
@@ -1,17 +0,0 @@
|
|||||||
" Defines a specific list of linters, that you wish to use for a language
|
|
||||||
" Install the flake8, python-pylint packages
|
|
||||||
let g:ale_linters = {
|
|
||||||
\ 'python': ['flake8', 'pylint'],
|
|
||||||
\ 'rust': ['rls'],
|
|
||||||
\}
|
|
||||||
|
|
||||||
let g:ale_fixers = {
|
|
||||||
\ 'python': ['yapf'],
|
|
||||||
\ 'rust': ['rustfmt']
|
|
||||||
\}
|
|
||||||
|
|
||||||
nmap <F10> :ALEFix<CR>
|
|
||||||
|
|
||||||
let g:ale_fix_on_save = 1
|
|
||||||
let g:airline#extensions#ale#enabled = 1
|
|
||||||
|
|
||||||
2
init.vim
2
init.vim
@@ -70,7 +70,7 @@ source ~/.config/nvim/rainbow.vim
|
|||||||
source ~/.config/nvim/neomake.vim
|
source ~/.config/nvim/neomake.vim
|
||||||
source ~/.config/nvim/keymap.vim
|
source ~/.config/nvim/keymap.vim
|
||||||
source ~/.config/nvim/timestamp.vim
|
source ~/.config/nvim/timestamp.vim
|
||||||
source ~/.config/nvim/ale.vim
|
|
||||||
source ~/.config/nvim/html.vim
|
source ~/.config/nvim/html.vim
|
||||||
|
source ~/.config/nvim/vim-lsp.vim
|
||||||
source ~/.config/nvim/python.vim
|
source ~/.config/nvim/python.vim
|
||||||
source ~/.config/nvim/rust.vim
|
source ~/.config/nvim/rust.vim
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ noremap <A-t> :belowright split +resize12 term://zsh<CR>
|
|||||||
noremap <C-S-d> :bnext <CR> :bd#<CR>
|
noremap <C-S-d> :bnext <CR> :bd#<CR>
|
||||||
|
|
||||||
" Map ale wraps to control+k and control+j
|
" Map ale wraps to control+k and control+j
|
||||||
nmap <silent> <C-k> <Plug>(ale_previous_wrap)
|
nmap <silent> <C-k> <Plug>(LspPreviousDiagnostic)
|
||||||
nmap <silent> <C-j> <Plug>(ale_next_wrap)
|
nmap <silent> <C-j> <Plug>(LspNextDiagnostic)
|
||||||
|
|
||||||
" Map vim-grammarous to <F6>
|
" Map vim-grammarous to <F6>
|
||||||
nmap <F6> :GrammarousCheck <CR>
|
nmap <F6> :GrammarousCheck <CR>
|
||||||
|
|||||||
4
plug.vim
4
plug.vim
@@ -15,6 +15,7 @@ Plug 'bling/vim-bufferline'
|
|||||||
Plug 'junegunn/fzf.vim'
|
Plug 'junegunn/fzf.vim'
|
||||||
Plug 'tpope/vim-commentary'
|
Plug 'tpope/vim-commentary'
|
||||||
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
|
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
|
||||||
|
Plug 'lighttiger2505/deoplete-vim-lsp'
|
||||||
Plug 'machakann/vim-highlightedyank'
|
Plug 'machakann/vim-highlightedyank'
|
||||||
|
|
||||||
" Use rainbow parenthesis and automatic closing parens
|
" Use rainbow parenthesis and automatic closing parens
|
||||||
@@ -22,7 +23,8 @@ Plug 'luochen1990/rainbow'
|
|||||||
Plug 'jiangmiao/auto-pairs'
|
Plug 'jiangmiao/auto-pairs'
|
||||||
|
|
||||||
" Linting plugin for multiple languages
|
" Linting plugin for multiple languages
|
||||||
Plug 'dense-analysis/ale'
|
Plug 'prabirshrestha/vim-lsp'
|
||||||
|
Plug 'mattn/vim-lsp-settings'
|
||||||
|
|
||||||
" Language support for LaTeX
|
" Language support for LaTeX
|
||||||
Plug 'vim-latex/vim-latex'
|
Plug 'vim-latex/vim-latex'
|
||||||
|
|||||||
@@ -3,3 +3,12 @@ au BufNewFile,BufRead *.py
|
|||||||
\ setlocal foldmethod=indent
|
\ setlocal foldmethod=indent
|
||||||
\ nospell
|
\ nospell
|
||||||
|
|
||||||
|
" register pyls as a language server.
|
||||||
|
if executable('pyls')
|
||||||
|
" pip install python-language-server
|
||||||
|
au User lsp_setup call lsp#register_server({
|
||||||
|
\ 'name': 'pyls',
|
||||||
|
\ 'cmd': {server_info->['pyls']},
|
||||||
|
\ 'allowlist': ['python'],
|
||||||
|
\ })
|
||||||
|
endif
|
||||||
|
|||||||
9
rust.vim
9
rust.vim
@@ -1,4 +1,11 @@
|
|||||||
" No spell checking in code file
|
" No spell checking in code file
|
||||||
autocmd BufNewFile,BufRead *.rs setlocal nospell
|
autocmd BufNewFile,BufRead *.rs setlocal nospell
|
||||||
|
|
||||||
|
if executable('rls')
|
||||||
|
" pip install rust-language-server
|
||||||
|
au User lsp_setup call lsp#register_server({
|
||||||
|
\ 'name': 'rls',
|
||||||
|
\ 'cmd': {server_info->['rls']},
|
||||||
|
\ 'allowlist': ['rust'],
|
||||||
|
\ })
|
||||||
|
endif
|
||||||
|
|||||||
36
vim-lsp.vim
Normal file
36
vim-lsp.vim
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
" Configure the vim-lsp plugin in order to register any language server.
|
||||||
|
"
|
||||||
|
|
||||||
|
function! s:on_lsp_buffer_enabled() abort
|
||||||
|
setlocal omnifunc=lsp#complete
|
||||||
|
setlocal signcolumn=yes
|
||||||
|
if exists('+tagfunc') | setlocal tagfunc=lsp#tagfunc | endif
|
||||||
|
nmap <buffer> gd <plug>(lsp-definition)
|
||||||
|
nmap <buffer> gs <plug>(lsp-document-symbol-search)
|
||||||
|
nmap <buffer> gS <plug>(lsp-workspace-symbol-search)
|
||||||
|
nmap <buffer> gr <plug>(lsp-references)
|
||||||
|
nmap <buffer> gi <plug>(lsp-implementation)
|
||||||
|
nmap <buffer> gt <plug>(lsp-type-definition)
|
||||||
|
nmap <buffer> <leader>rn <plug>(lsp-rename)
|
||||||
|
nmap <buffer> [g <plug>(lsp-previous-diagnostic)
|
||||||
|
nmap <buffer> ]g <plug>(lsp-next-diagnostic)
|
||||||
|
nmap <buffer> K <plug>(lsp-hover)
|
||||||
|
inoremap <buffer> <expr><c-f> lsp#scroll(+4)
|
||||||
|
inoremap <buffer> <expr><c-d> lsp#scroll(-4)
|
||||||
|
|
||||||
|
let g:lsp_format_sync_timeout = 1000
|
||||||
|
autocmd! BufWritePre *.rs,*.go call execute('LspDocumentFormatSync')
|
||||||
|
|
||||||
|
" refer to doc to add more commands
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
augroup lsp_install
|
||||||
|
au!
|
||||||
|
" call s:on_lsp_buffer_enabled only for languages that has the server registered.
|
||||||
|
autocmd User lsp_buffer_enabled call s:on_lsp_buffer_enabled()
|
||||||
|
augroup END
|
||||||
|
|
||||||
|
" Set folding
|
||||||
|
set foldmethod=expr
|
||||||
|
\ foldexpr=lsp#ui#vim#folding#foldexpr()
|
||||||
|
\ foldtext=lsp#ui#vim#folding#foldtext()
|
||||||
Reference in New Issue
Block a user