aboutsummaryrefslogtreecommitdiff
path: root/conf
diff options
context:
space:
mode:
Diffstat (limited to 'conf')
-rw-r--r--conf/keymaps.vim43
-rw-r--r--conf/plugins.vim57
2 files changed, 46 insertions, 54 deletions
diff --git a/conf/keymaps.vim b/conf/keymaps.vim
index 066dd21..351520d 100644
--- a/conf/keymaps.vim
+++ b/conf/keymaps.vim
@@ -145,46 +145,3 @@ noremap <leader>sa zg
" show the list of alternatives for the word
noremap <leader>s? z=
-
-"""""""""""""""""""
-" LSP
-"""""""""""""""""""
-inoremap <expr><S-TAB> coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"
-
-" Make <CR> to accept selected completion item or notify coc.nvim to format
-" <C-g>u breaks current undo, please make your own choice
-inoremap <silent><expr> <cr> pumvisible() ? coc#_select_confirm() :
- \"\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"
-let g:coc_snippet_next = '<tab>'
-
-nmap <silent> gp <Plug>(coc-diagnostic-prev)
-nmap <silent> gn <Plug>(coc-diagnostic-next)
-
-" GoTo code navigation
-nmap <silent> gd <Plug>(coc-definition)
-nmap <silent> gy <Plug>(coc-type-definition)
-nmap <silent> gi <Plug>(coc-implementation)
-nmap <silent> gr <Plug>(coc-references)
-
-" Use K to show documentation in preview window
-nnoremap <silent> gh :call ShowDocumentation()<CR>
-
-function! ShowDocumentation()
- if CocAction('hasProvider', 'hover')
- call CocActionAsync('doHover')
- else
- call feedkeys('K', 'in')
- endif
-endfunction
-
-" Highlight the symbol and its references when holding the cursor
-autocmd CursorHold * silent call CocActionAsync('highlight')
-
-" Symbol renaming
-nmap <leader>gR <Plug>(coc-rename)
-
-" Formatting selected code
-xmap <leader>gf <Plug>(coc-format-selected)
-nmap <leader>gf <Plug>(coc-format-selected)
-
-nmap <leader>qf <Plug>(coc-fix-current)
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.