From e60e88121514b71520b5db78ed65a28a4eebf07f Mon Sep 17 00:00:00 2001 From: Agatha Lovelace Date: Tue, 21 Jun 2022 21:04:29 +0200 Subject: [PATCH] Update vim config --- .config/nvim/init.vim | 71 ++++++++++++++++++++++++++++--------------- .vimrc | 35 +++++++++++++-------- 2 files changed, 68 insertions(+), 38 deletions(-) diff --git a/.config/nvim/init.vim b/.config/nvim/init.vim index f6af177..7766d8f 100644 --- a/.config/nvim/init.vim +++ b/.config/nvim/init.vim @@ -1,12 +1,12 @@ -" __ -" / -, -" || ) ; ' -" ~||---) _-_ /'\\ \\/\ \\ \\/\\/\\ -" ~||---, || \\ || || || | || || || || -" ~|| / ||/ || || || | || || || || -" |, / \\,/ \\,/ \\/ \\ \\ \\ \\ -" -_- --~ -" +" __ +" / -, +" || ) ; ' +" ~||---) _-_ /'\\ \\/\ \\ \\/\\/\\ +" ~||---, || \\ || || || | || || || || +" ~|| / ||/ || || || | || || || || +" |, / \\,/ \\,/ \\/ \\ \\ \\ \\ +" -_- --~ +" " import .vimrc set runtimepath^=~/.vim runtimepath+=~/.vim/after @@ -24,7 +24,17 @@ set updatetime=500 nnoremap :lua vim.lsp.buf.code_action() " 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 }, @@ -52,12 +62,12 @@ let g:lightline.component_type = { \ 'linter_ok': 'right', \ } -" lightline symbols +" lightline symbols let g:lightline#ale#indicator_checking = "\uf110" -let g:lightline#ale#indicator_infos = "\uf129" -let g:lightline#ale#indicator_warnings = "\uf071" -let g:lightline#ale#indicator_errors = "\uf05e" -let g:lightline#ale#indicator_ok = "\uf00c" +let g:lightline#ale#indicator_infos = "\uf129" +let g:lightline#ale#indicator_warnings = "\uf071" +let g:lightline#ale#indicator_errors = "\uf05e" +let g:lightline#ale#indicator_ok = "\uf00c" " lightline modules let g:lightline.active = { @@ -66,23 +76,23 @@ let g:lightline.active = { \ ['gitbranch', 'readonly', 'filename', 'modified'] \ ], \ 'right': [ -\ ['linter_checking', 'linter_errors', 'linter_warnings'], -\ ['lineinfo'], -\ ['percent'], +\ ['linter_checking', 'linter_errors', 'linter_warnings'], +\ ['lineinfo'], +\ ['percent'], \ ['fileformat', 'fileencoding', 'filetype'] -\ ] +\ ] \} lua << EOF -- cursor animations -require('specs').setup{ +require('specs').setup{ show_jumps = true, min_jump = 30, popup = { delay_ms = 100, -- delay before popup displays - inc_ms = 20, -- time increments used for fade/resize effects + inc_ms = 20, -- time increments used for fade/resize effects blend = 10, -- starting blend, between 0-100 (fully transparent), see :h winblend width = 10, winhl = "PMenu", @@ -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 = { diff --git a/.vimrc b/.vimrc index 8d7b929..aaebd3f 100644 --- a/.vimrc +++ b/.vimrc @@ -1,10 +1,17 @@ -" ; ' -" \\/\ \\ \\/\\/\\ ,._-_ _-_ -" || | || || || || || || -" || | || || || || || || -" \\/ \\ \\ \\ \\ \\, \\,/ - +" ; ' +" \\/\ \\ \\/\\/\\ ,._-_ _-_ +" || | || || || || || || +" || | || || || || || || +" \\/ \\ \\ \\ \\ \\, \\,/ + +" 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,10 +28,11 @@ 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' - + Plug 'ryanoasis/vim-devicons' " don't install these plugins on remote servers @@ -34,7 +42,7 @@ if has('nvim') Plug 'j-hui/fidget.nvim' Plug 'jghauser/mkdir.nvim' Plug 'stevearc/dressing.nvim' - Plug 'airblade/vim-gitgutter' + Plug 'airblade/vim-gitgutter' Plug 'antoinemadec/FixCursorHold.nvim' Plug 'edluffy/specs.nvim' Plug 'folke/lsp-colors.nvim' @@ -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' @@ -56,7 +65,7 @@ if has('nvim') Plug 'w0rp/ale' Plug 'xuyuanp/nerdtree-git-plugin' endif - + call plug#end() " Lightline config @@ -73,14 +82,14 @@ let g:VM_maps = {} let g:VM_maps["I BS"] = '' " Nerdtree/git config -let g:NERDTreeGitStatusConcealBrackets = 1 +let g:NERDTreeGitStatusConcealBrackets = 1 -" Aliases +" Aliases command Header FIGlet -f Gothic cmap W w !sudo tee > /dev/null % nnoremap :NERDTreeTabsToggle - + " Colorscheme set background=dark set termguicolors @@ -90,7 +99,7 @@ let bgcolor = synIDattr(hlID("Normal"), "bg") let fgcolor = synIDattr(hlID("Identifier"), "fg") let colors = "\033]11;" . fgcolor . "\007\033]11;" . bgcolor . "\007" -if has('gui_running') || has('nvim') +if has('gui_running') || has('nvim') autocmd VimEnter * call chansend(v:stderr, colors) autocmd VimLeave * call chansend(v:stderr, "\033]110\007\033]111\007") else