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> nnoremap <C-c><C-a> :lua vim.lsp.buf.code_action()<CR>
" ale " 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 = { let g:ale_rust_analyzer_config = {
\ 'cargo': { 'loadOutDirsFromCheck': v:true }, \ 'cargo': { 'loadOutDirsFromCheck': v:true },
@ -95,15 +105,26 @@ require('specs').setup{
} }
-- lsp config -- lsp config
local lsp_installer = require("nvim-lsp-installer")
local nvim_lsp = require 'lspconfig' local nvim_lsp = require 'lspconfig'
local cmp = require'cmp' 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()) local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
require('lspconfig')['rust_analyzer'].setup { local servers = { 'rust_analyzer', 'emmet_ls', 'cssls' }
capabilities = capabilities for _, lsp in ipairs(servers) do
nvim_lsp[lsp].setup {
capabilities = capabilities,
} }
end
vim.diagnostic.config({ vim.diagnostic.config({
virtual_text = { 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 " Load plugins
call plug#begin('~/.vim/bundle') call plug#begin('~/.vim/bundle')
@ -21,6 +28,7 @@ Plug 'lilydjwg/colorizer'
Plug 'mg979/vim-visual-multi' Plug 'mg979/vim-visual-multi'
Plug 'owickstrom/vim-colors-paramount' Plug 'owickstrom/vim-colors-paramount'
Plug 'raimondi/delimitmate' Plug 'raimondi/delimitmate'
Plug 'scrooloose/nerdtree'
Plug 'tpope/vim-commentary' Plug 'tpope/vim-commentary'
Plug 'vim-scripts/nginx.vim', {'for': 'nginx'} Plug 'vim-scripts/nginx.vim', {'for': 'nginx'}
Plug 'yuttie/comfortable-motion.vim' Plug 'yuttie/comfortable-motion.vim'
@ -48,6 +56,7 @@ if has('nvim')
Plug 'hrsh7th/vim-vsnip' Plug 'hrsh7th/vim-vsnip'
Plug 'kyazdani42/nvim-web-devicons' Plug 'kyazdani42/nvim-web-devicons'
Plug 'maximbaz/lightline-ale' Plug 'maximbaz/lightline-ale'
Plug 'williamboman/nvim-lsp-installer'
Plug 'neovim/nvim-lspconfig' Plug 'neovim/nvim-lspconfig'
Plug 'nvim-lua/plenary.nvim' Plug 'nvim-lua/plenary.nvim'
Plug 'nvim-telescope/telescope.nvim' Plug 'nvim-telescope/telescope.nvim'