Update vim config

This commit is contained in:
Agatha Lovelace 2022-06-21 21:04:29 +02:00
parent a9815d3f5b
commit e60e881215
Signed by: sorceress
GPG Key ID: 11BBCFC65FC9F401
2 changed files with 68 additions and 38 deletions

View File

@ -24,7 +24,17 @@ set updatetime=500
nnoremap <C-c><C-a> :lua vim.lsp.buf.code_action()<CR>
" ale
let g:ale_linters = {'rust': ['analyzer']}
let g:ale_linters = {'rust': ['analyzer'], 'css': ['csslint']}
let g:ale_fixers = {
\ '*': ['remove_trailing_lines', 'trim_whitespace'],
\ 'html': ['prettier'],
\ 'css': ['prettier'],
\ }
let g:ale_fix_on_save = 1
let g:ale_javascript_prettier_options = '--tab-width 4'
let g:ale_rust_analyzer_config = {
\ 'cargo': { 'loadOutDirsFromCheck': v:true },
@ -95,15 +105,26 @@ require('specs').setup{
}
-- lsp config
local lsp_installer = require("nvim-lsp-installer")
local nvim_lsp = require 'lspconfig'
local cmp = require'cmp'
nvim_lsp.rust_analyzer.setup({})
lsp_installer.setup {
automatic_installation = true
}
for _, server in ipairs(lsp_installer.get_installed_servers()) do
nvim_lsp[server.name].setup {}
end
local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
require('lspconfig')['rust_analyzer'].setup {
capabilities = capabilities
local servers = { 'rust_analyzer', 'emmet_ls', 'cssls' }
for _, lsp in ipairs(servers) do
nvim_lsp[lsp].setup {
capabilities = capabilities,
}
end
vim.diagnostic.config({
virtual_text = {

9
.vimrc
View File

@ -5,6 +5,13 @@
" || | || || || || || ||
" \\/ \\ \\ \\ \\ \\, \\,/
" Install VimPlug
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
" Load plugins
call plug#begin('~/.vim/bundle')
@ -21,6 +28,7 @@ Plug 'lilydjwg/colorizer'
Plug 'mg979/vim-visual-multi'
Plug 'owickstrom/vim-colors-paramount'
Plug 'raimondi/delimitmate'
Plug 'scrooloose/nerdtree'
Plug 'tpope/vim-commentary'
Plug 'vim-scripts/nginx.vim', {'for': 'nginx'}
Plug 'yuttie/comfortable-motion.vim'
@ -48,6 +56,7 @@ if has('nvim')
Plug 'hrsh7th/vim-vsnip'
Plug 'kyazdani42/nvim-web-devicons'
Plug 'maximbaz/lightline-ale'
Plug 'williamboman/nvim-lsp-installer'
Plug 'neovim/nvim-lspconfig'
Plug 'nvim-lua/plenary.nvim'
Plug 'nvim-telescope/telescope.nvim'