WIP: Switch to ALE with a few LS setup
This commit is contained in:
parent
2b6b13fcda
commit
6a51d76881
|
@ -0,0 +1,47 @@
|
||||||
|
#! /bin/bash
|
||||||
|
|
||||||
|
## Language servers
|
||||||
|
|
||||||
|
# bash
|
||||||
|
npm install -g bash-language-server
|
||||||
|
|
||||||
|
# Kotlin
|
||||||
|
# https://github.com/fwcd/kotlin-language-server/blob/master/BUILDING.md
|
||||||
|
|
||||||
|
# Python
|
||||||
|
pip install --user python-language-server
|
||||||
|
pip3 install --user python-language-server
|
||||||
|
|
||||||
|
# Rust
|
||||||
|
rustup component add rls rust-analysis rust-src
|
||||||
|
|
||||||
|
## Linters
|
||||||
|
|
||||||
|
# Python
|
||||||
|
pip install flake8 mypy
|
||||||
|
|
||||||
|
# CSS
|
||||||
|
npm install -g csslint
|
||||||
|
|
||||||
|
# Vim
|
||||||
|
pip install --user vim-vint
|
||||||
|
pip3 install --user vim-vint
|
||||||
|
|
||||||
|
# YAML
|
||||||
|
pip install --user yamllint
|
||||||
|
pip3 install --user yamllint
|
||||||
|
|
||||||
|
# Makefile
|
||||||
|
# https://github.com/mrtazz/checkmake
|
||||||
|
|
||||||
|
## Fixers
|
||||||
|
|
||||||
|
# CSS/JS/HTML/JSON/YAML/Markdown/and more!
|
||||||
|
npm install -g prettier
|
||||||
|
|
||||||
|
# Python
|
||||||
|
pip install --user black autopep8 reorder-python-imports
|
||||||
|
pip3 install --user black autopep8 reorder-python-imports
|
||||||
|
|
||||||
|
# Rust
|
||||||
|
rustup component add rustfmt
|
|
@ -34,9 +34,16 @@ cmap cd. lcd %:p:h
|
||||||
" Bind Make to F5 like other IDEs
|
" Bind Make to F5 like other IDEs
|
||||||
nnoremap <F5> :make<CR>
|
nnoremap <F5> :make<CR>
|
||||||
|
|
||||||
" Remap Ctrl+Space for auto Complete
|
" Ctrl-Space for omnicompletions
|
||||||
inoremap <C-Space> <C-n>
|
inoremap <silent><expr> <C-Space> pumvisible() \|\| &omnifunc == '' ?
|
||||||
inoremap <Nul> <C-n>
|
\ "\<lt>C-n>" :
|
||||||
|
\ "\<lt>C-x>\<lt>C-o><c-r>=pumvisible() ?" .
|
||||||
|
\ "\"\\<lt>c-n>\\<lt>c-p>\\<lt>c-n>\" :" .
|
||||||
|
\ "\" \\<lt>bs>\\<lt>C-n>\"\<CR>"
|
||||||
|
imap <C-@> <C-Space>
|
||||||
|
augroup close_docs
|
||||||
|
autocmd! CompleteDone * if pumvisible() == 0 | pclose | endif
|
||||||
|
augroup end
|
||||||
|
|
||||||
" Toggle highlighting with \hr (highlight row)
|
" Toggle highlighting with \hr (highlight row)
|
||||||
nnoremap <leader>hr :set cursorline!<CR>
|
nnoremap <leader>hr :set cursorline!<CR>
|
||||||
|
|
|
@ -33,36 +33,79 @@ endif
|
||||||
" }} Searching
|
" }} Searching
|
||||||
|
|
||||||
" Programming {{
|
" Programming {{
|
||||||
|
Plug 'FooSoft/vim-argwrap'
|
||||||
|
|
||||||
" TODO: Maybe replace with coc.nvim. If I'm doing a lot of development, I will
|
Plug 'tomtom/tcomment_vim', { 'on': ['TComment', 'TCommentBlock'] }
|
||||||
" have latest versions of vim or nvim
|
nnoremap // :TComment<CR>
|
||||||
" Only need one fallback, maybe neocomplcache
|
vnoremap // :TCommentBlock<CR>
|
||||||
call s:smart_source_rc('plugins/omnicompletion')
|
|
||||||
if !g:vim_as_an_ide || g:gui.has_autocomplete_features
|
" Install ALE
|
||||||
" We'll keep Oni's autocomplete with Language Server
|
if !g:vim_as_an_ide || g:gui.has_linter_features
|
||||||
elseif (has('nvim') || v:version >= 800) && has('python3')
|
" We'll keep skip adding any of these features
|
||||||
call s:smart_source_rc('plugins/deoplete')
|
elseif has('nvim') || v:version >= 800
|
||||||
else
|
Plug 'dense-analysis/ale'
|
||||||
call s:smart_source_rc('plugins/neocomplcache')
|
set omnifunc=ale#completion#OmniFunc
|
||||||
|
let g:airline#extensions#ale#enabled = 1
|
||||||
|
let g:ale_lint_on_enter = 0
|
||||||
|
|
||||||
|
" TODO: Maybe move this to something per language
|
||||||
|
" TODO: Handle installing of language servers on setup (see ./install-language-servers.sh)
|
||||||
|
" NOTE: Some of these are installed when bootstrapping environment,
|
||||||
|
" outside of vim setup
|
||||||
|
let g:ale_linters = {
|
||||||
|
\ 'python': ['pyls', 'flake8', 'mypy', 'pylint'],
|
||||||
|
\ 'go': ['gopls', 'golint', 'gometalinter'],
|
||||||
|
\ 'rust': ['rls', 'cargo'],
|
||||||
|
\ 'sh': ['language_server', 'shell', 'shellcheck'],
|
||||||
|
\}
|
||||||
|
let g:ale_fixers = {
|
||||||
|
\ 'go': ['gofmt', 'goimports'],
|
||||||
|
\ 'rust': ['rustfmt'],
|
||||||
|
\}
|
||||||
|
|
||||||
|
" Auto-complete from ALE, possible alternative to asyncomplete
|
||||||
|
" let g:ale_completion_enabled = 1
|
||||||
|
|
||||||
|
" Enable asyncomplete
|
||||||
|
Plug 'prabirshrestha/asyncomplete.vim'
|
||||||
|
" Add ALE to asyncomplete
|
||||||
|
augroup acomp_setup
|
||||||
|
au User asyncomplete_setup call asyncomplete#register_source(asyncomplete#sources#ale#get_source_options({
|
||||||
|
\ 'priority': 10,
|
||||||
|
\ }))
|
||||||
|
augroup end
|
||||||
|
|
||||||
|
" let g:asyncomplete_auto_popup = 0
|
||||||
|
" Make asyncomplete manually triggered
|
||||||
|
function! s:check_back_space() abort
|
||||||
|
let col = col('.') - 1
|
||||||
|
return !col || getline('.')[col - 1] =~? '\s'
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
inoremap <silent><expr> <C-Space>
|
||||||
|
\ pumvisible() ? "\<C-n>" :
|
||||||
|
\ <SID>check_back_space() ? "\<TAB>" :
|
||||||
|
\ asyncomplete#force_refresh()
|
||||||
end
|
end
|
||||||
|
|
||||||
call s:smart_source_rc('plugins/tcomment_vim')
|
" TODO: Figure out if this is needed or if the ale completions are sufficient
|
||||||
|
" call s:smart_source_rc('plugins/omnicompletion')
|
||||||
|
|
||||||
if g:vim_as_an_ide && (v:version > 703) && !g:gui.has_ctags_features
|
if g:vim_as_an_ide && (v:version > 703) && !g:gui.has_ctags_features
|
||||||
call s:smart_source_rc('plugins/tagbar')
|
call s:smart_source_rc('plugins/tagbar')
|
||||||
Plug 'ludovicchabant/vim-gutentags' " Auto generate tags files
|
Plug 'ludovicchabant/vim-gutentags' " Auto generate tags files
|
||||||
command! TagsUpdate :GutentagsUpdate<CR>
|
command! TagsUpdate :GutentagsUpdate
|
||||||
end
|
end
|
||||||
|
|
||||||
" TODO: Maybe ALE. Similar reason as coc.nvim. Probably only using latest vim
|
" TODO: Maybe ALE. Similar reason as coc.nvim. Probably only using latest vim
|
||||||
" if developing seriously
|
" if developing seriously
|
||||||
if !g:vim_as_an_ide
|
" if !g:vim_as_an_ide || g:ale_completion_enabled
|
||||||
" Do nothing
|
" " Do nothing
|
||||||
elseif (has('nvim') || v:version >= 800)
|
" elseif (has('nvim') || v:version >= 800)
|
||||||
call s:smart_source_rc('plugins/neomake')
|
" call s:smart_source_rc('plugins/neomake')
|
||||||
else
|
" else
|
||||||
call s:smart_source_rc('plugins/syntastic')
|
" call s:smart_source_rc('plugins/syntastic')
|
||||||
endif
|
" endif
|
||||||
" }}
|
" }}
|
||||||
|
|
||||||
" GUI {{
|
" GUI {{
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
Plug 'majutsushi/tagbar', { 'on': 'TagbarToggle' }
|
Plug 'majutsushi/tagbar', { 'on': 'TagbarToggle' }
|
||||||
nnoremap <silent> <F8> :TagbarToggle<CR>
|
nnoremap <silent> <F8> :TagbarToggle<CR>
|
||||||
let g:tagbar_autofocus = 1 " Autofocus tagbar
|
let g:tagbar_autofocus = 1 " Autofocus tagbar
|
||||||
|
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
Plug 'tomtom/tcomment_vim', { 'on': ['TComment', 'TCommentBlock'] }
|
|
||||||
nnoremap // :TComment<CR>
|
|
||||||
vnoremap // :TCommentBlock<CR>
|
|
Loading…
Reference in New Issue