aboutsummaryrefslogtreecommitdiff
path: root/conf/plugins.vim
diff options
context:
space:
mode:
authorOxbian <oxbian@mailbox.org>2025-02-04 19:34:35 -0500
committerOxbian <oxbian@mailbox.org>2025-02-04 19:34:35 -0500
commit14779f654194f86b3cec6d89e3fef9e792d29026 (patch)
tree4967fb59a7d73883156fc0673bf2c17ce1d6ef7c /conf/plugins.vim
parente65597837ec3057989f6bc67d90e5c10d4f3d14e (diff)
downloadvimrc-14779f654194f86b3cec6d89e3fef9e792d29026.tar.gz
vimrc-14779f654194f86b3cec6d89e3fef9e792d29026.zip
feat: working + clean linter/fixer/completion/LSP
Diffstat (limited to 'conf/plugins.vim')
-rw-r--r--conf/plugins.vim57
1 files changed, 46 insertions, 11 deletions
diff --git a/conf/plugins.vim b/conf/plugins.vim
index 89ca4c3..bdfa5ea 100644
--- a/conf/plugins.vim
+++ b/conf/plugins.vim
@@ -22,7 +22,7 @@ Plug 'liuchengxu/vim-which-key' " Show leader mapping cheatsheet
Plug 'airblade/vim-gitgutter' " Git diff
" Autocompletion, linter, syntax
-Plug 'neoclide/coc.nvim', {'branch': 'release'}
+Plug 'dense-analysis/ale'
" Tools
Plug 'ap/vim-css-color' " rgb, hex color preview
@@ -35,7 +35,25 @@ filetype plugin indent on " Allow filetype detection, plugins, indentation
" Configuration
"""""""""""""""""""""""""
" LSP
-let g:coc_global_extensions = ['coc-json', 'coc-markdownlint'] " You can add other coc extensions here
+let g:ale_python_auto_virtualenv = 1
+let g:ale_completion_enabled = 1
+let g:ale_floating_preview = 1 " Show hover doc & detail in a popup
+let g:ale_fix_on_save = 1
+
+" Stop linting when writing
+let g:ale_lint_on_text_changed = 'never'
+let g:ale_lint_on_insert_leave = 0
+let g:ale_hover_cursor = 1
+let g:ale_set_balloons = 1 " Show error when mouse over it
+
+" Linters and fixers (don't forget to setup LSP as linters)
+let g:ale_linters = {
+\ 'python': ['pylsp', 'flake8', 'pylint', 'mypy']
+\}
+
+let g:ale_fixers = {
+\ 'python': ['black', 'isort', 'autopep8']
+\}
" Netrw (filetree built-in vim)
let g:netrw_keepdir = 0 " Reload buffer usefull when moving or removing file
@@ -54,6 +72,21 @@ let g:currentmode={
\ 'Rv' : 'V·Replace ',
\ 'c' : 'Command ',
\}
+
+" Getting numbers of errors in ALE
+function! LinterStatus() abort
+ let l:counts = ale#statusline#Count(bufnr(''))
+
+ let l:all_errors = l:counts.error + l:counts.style_error
+ let l:all_non_errors = l:counts.total - l:all_errors
+
+ return l:counts.total == 0 ? 'OK' : printf(
+ \ '%dW %dE',
+ \ all_non_errors,
+ \ all_errors
+ \)
+
+endfunction
set laststatus=2
set statusline=
" VIM Mode
@@ -66,6 +99,7 @@ set statusline+=%{&readonly?'\ ':''}
set statusline+=%=%y
set statusline+=\ \|\ %{&fileencoding?&fileencoding:&encoding}
set statusline+=\ \|\ [%{&fileformat}\]
+set statusline+=\ \|\ %{LinterStatus()}
" Line count and percentage
set statusline+=\ \|\ %l:%c
set statusline+=\ [%p%%]\
@@ -119,15 +153,16 @@ let g:which_key_map.h = {
\ }
" LSP key help
+" Activer WhichKey pour ALE
let g:which_key_map.g = {
\ 'name' : '+LSP',
- \ 'd' : 'go to definition',
- \ 'n' : 'next diagnostic',
- \ 'p' : 'previous diagnostic',
- \ 'r' : 'go to reference',
- \ 'R' : 'rename object',
- \ 'y' : 'type definition',
- \ 'i' : 'go to implementation',
- \ 'h' : 'documentation',
- \ 'f' : 'format document',
+ \ 'd' : [':ALEGoToDefinition', 'go to definition'],
+ \ 'n' : [':ALENext', 'next diagnostic'],
+ \ 'p' : [':ALEPrevious', 'previous diagnostic'],
+ \ 'r' : [':ALEFindReferences', 'go to reference'],
+ \ 'R' : [':ALERename', 'rename object'],
+ \ 'y' : [':ALEType', 'type definition'],
+ \ 'i' : [':ALEGoToImplementation', 'go to implementation'],
+ \ 'h' : [':ALEHover', 'documentation'],
+ \ 'f' : [':ALEFix', 'format document'],
\ }
ArKa projects. All rights to me, and your next child right arm.