vim/vimrc

109 lines
2.5 KiB
VimL

colorscheme industry
set cb=unnamed,unnamedplus
set wildmode=longest,list,full
set backspace=indent,eol,start
set cmdheight=1
set bg=light
set number relativenumber
set completeopt=menu
set smartindent
set sta
set cpt=.,w,b,i,d
set tf
set foldmethod=syntax
set path+=**
set nocompatible
set sc
set nosmd
set list listchars=trail,eol:,tab:\
set directory=$HOME/.vim/swap//
set shm=asTIt
set fo=ron
set is hls
set lbr
set lz
set fcl=all fml=4 fdn=4 nofen
filetype plugin indent on
syntax on
let g:ale_fixers = {
\ 'go': ['gofmt'],
\ 'c': ['clang-format'],
\ 'cpp': ['clang-format'],
\ 'rust': ['rustfmt'],
\}
let g:ale_linters = {
\ 'go': ['gopls'],
\ 'c': ['clangd'],
\ 'cpp': ['clangd'],
\ 'py': ['pyright-langserver'],
\ 'rust': ['analyzer'],
\}
let g:ale_completion_enabled = 1
let g:ale_fix_on_save = 1
let g:ale_hover_to_preview = 1
let g:ale_cpp_clangcheck_options = '--analyzer-output text'
let g:ale_rust_cargo_check_all_targets = 1
let g:ale_rust_cargo_check_tests = 1
let g:ale_rust_cargo_use_clippy = executable('cargo-clippy')
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
let g:airline_powerline_fonts = v:true
let g:airline#extensions#tabline#enabled = v:true
let g:airline_skip_empty_sections = v:true
let g:airline_theme='term'
cnoremap w!! execute 'silent! write !doas tee % >/dev/null' <bar> edit! <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
packloadall
silent! helptags ALL