misc/.vimrc
2025-02-10 22:57:01 +01:00

72 lines
2.0 KiB
VimL

let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim'
if empty(glob(data_dir . '/autoload/plug.vim'))
silent execute '!curl -fLo '.data_dir.'/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
call plug#begin('~/.vim/plugged')
Plug 'dense-analysis/ale'
Plug 'prabirshrestha/vim-lsp'
Plug 'rhysd/vim-lsp-ale'
Plug 'mattn/vim-lsp-settings'
Plug 'prabirshrestha/asyncomplete-lsp.vim'
Plug 'prabirshrestha/asyncomplete.vim'
Plug 'jiangmiao/auto-pairs'
call plug#end()
set nocompatible
set encoding=utf-8
set fileencodings=utf-8
set backspace=indent,eol,start
set number
set ruler
set tabstop=2
set shiftwidth=2
set softtabstop=2
set expandtab
set autoindent
set smartindent
set cursorline
syntax on
filetype plugin indent on
let g:asyncomplete_auto_popup = 1
let g:asyncomplete_auto_completeopt = 0
let g:asyncomplete#completion_use_lsp = 1
let g:asyncomplete_lsp_timeout = 1000
set completeopt=menuone,noinsert,noselect,preview
if executable('ccls')
au User lsp_setup call lsp#register_server({
\ 'name': 'ccls',
\ 'cmd': {server_info->['ccls']},
\ 'root_uri': {server_info->lsp#utils#path_to_uri(lsp#utils#find_nearest_parent_file_directory(lsp#utils#get_buffer_path(), 'compile_commands.json'))},
\ 'initialization_options': {},
\ 'whitelist': ['c', 'cpp', 'objc', 'objcpp', 'cc'],
\ })
endif
if executable('bash-language-server')
augroup LspBash
autocmd!
autocmd User lsp_setup call lsp#register_server({
\ 'name': 'bash-language-server',
\ 'cmd': {server_info->[&shell, &shellcmdflag, 'bash-language-server start']},
\ 'allowlist': ['sh'],
\ })
augroup END
endif
if executable('pylsp')
au User lsp_setup call lsp#register_server({
\ 'name': 'pylsp',
\ 'cmd': {server_info->['pylsp']},
\ 'whitelist': ['python'],
\ 'workspace_config': {'pylsp': {'plugins': {'pydocstyle': {'enabled': v:true}}}}
\ })
endif