From 8e19fc31b443353b4665da3489e835dac03a922c Mon Sep 17 00:00:00 2001 From: Alex Denes Date: Fri, 8 Apr 2022 08:19:33 +0000 Subject: [PATCH] Fix ALE, generate help, set completion for clevertab per buffer, disable mouse preview --- vimrc | 53 ++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 46 insertions(+), 7 deletions(-) diff --git a/vimrc b/vimrc index c652810..f8a0082 100644 --- a/vimrc +++ b/vimrc @@ -1,22 +1,45 @@ -set mouse=a cb=unnamed,unnamedplus wim=longest,list,full backspace=indent,eol,start cmdheight=1 bg=dark nu rnu cot=menu si sta cpt=.,w,b,i tf foldmethod=syntax path+=** nocompatible sc nosmd listchars=trail:·,eol:,tab:\ list directory=$HOME/.vim/swap// shm=asTIt fo=rn hls lbr is lz +set cb=unnamed,unnamedplus wim=longest,list,full backspace=indent,eol,start cmdheight=1 bg=dark nu rnu cot=menu si sta cpt=.,w,b,i tf foldmethod=syntax path+=** nocompatible sc nosmd listchars=trail:·,eol:,tab:\ list directory=$HOME/.vim/swap// shm=asTIt fo=rn hls lbr is lz filetype plugin indent on syntax on colorscheme delek let g:ale_completion_enabled = 1 -let g:ale_lint_on_text_changed = 'never' -let g:ale_lint_on_insert_leave = 0 -let g:ale_lint_on_enter = 0 let g:ale_fix_on_save = 1 +let g:ale_hover_to_preview = 1 let g:ale_fixers = { \ '*': ['remove_trailing_lines', 'trim_whitespace'], \ 'go': ['gofmt'], \} -set omnifunc=ale#completion#OmniFunc -highlight clear ALEErrorSign -highlight clear ALEWarningSign +let g:ale_sign_error = 'E>' +let g:ale_sign_warning = 'W>' +let g:ale_sign_info = 'I>' +let g:ale_floating_window_border = '' +let g:ale_floating_preview = 1 +let g:ale_detail_to_floating_preview = 1 +let g:ale_hover_to_preview = 1 +let g:ale_hover_to_floating_preview = 1 +highlight SignColumn ctermbg=none let g:airline#extensions#ale#enabled = 1 +function BufferSettings() + let lsp_found=0 + for linter in ale#linter#Get(&filetype) + if !empty(linter.lsp) && ale#lsp_linter#CheckWithLSP(bufnr(''), linter) + let lsp_found=1 + endif + endfor + if (lsp_found) + nnoremap K :ALEDocumentation + nnoremap gr :ALEFindReferences + nnoremap gd :ALEGoToDefinition + nnoremap gy :ALEGoToTypeDefinition + nnoremap gh :ALEHover + + setlocal omnifunc=ale#completion#OmniFunc + endif +endfunction +autocmd BufRead,FileType * call BufferSettings() + let g:netrw_banner = 0 let g:netrw_liststile = 3 @@ -28,8 +51,24 @@ let g:airline_theme='term' cnoremap w!! execute 'silent! write !doas tee % >/dev/null' edit! cnoremap i! execute 'silent! write !doas make install' +function! CleverTab() + if &omnifunc != '' + return "\\" + elseif &spell + return "\\" + else + return "\\" + endif +endfunction + +inoremap =CleverTab() +inoremap + autocmd FileType yaml setlocal sw=8 sts=8 expandtab autocmd FileType tex command! Comp execute 'silent !pdflatex %' redraw! autocmd FileType less command! Comp execute 'silent !lessc % %:r.css' redraw! autocmd FileType tex command! Compdoc execute 'silent !pandoc -t docx % -o %:r.docx' redraw! + +packloadall +silent! helptags ALL