Fix ALE, generate help, set completion for clevertab per buffer, disable mouse preview

This commit is contained in:
Alex D. 2022-04-08 08:19:33 +00:00
parent a0ba024c4b
commit 8e19fc31b4
Signed by: caskd
GPG Key ID: F92BA85F61F4C173
1 changed files with 46 additions and 7 deletions

53
vimrc
View File

@ -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 <buffer> K :ALEDocumentation<cr>
nnoremap <buffer> gr :ALEFindReferences<cr>
nnoremap <buffer> gd :ALEGoToDefinition<cr>
nnoremap <buffer> gy :ALEGoToTypeDefinition<cr>
nnoremap <buffer> gh :ALEHover<cr>
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' <bar> edit! <CR>
cnoremap i! execute 'silent! write !doas make install' <CR>
function! CleverTab()
if &omnifunc != ''
return "\<C-X>\<C-O>"
elseif &spell
return "\<C-X>\<C-S>"
else
return "\<C-X>\<C-P>"
endif
endfunction
inoremap <silent><tab> <c-r>=CleverTab()<cr>
inoremap <silent><s-tab> <Tab>
autocmd FileType yaml setlocal sw=8 sts=8 expandtab
autocmd FileType tex command! Comp execute 'silent !pdflatex %' <bar> redraw!
autocmd FileType less command! Comp execute 'silent !lessc % %:r.css' <bar> redraw!
autocmd FileType tex command! Compdoc execute 'silent !pandoc -t docx % -o %:r.docx' <bar> redraw!
packloadall
silent! helptags ALL