From dfcc4d85d821e2259f627916d4ad9dd42e058637 Mon Sep 17 00:00:00 2001 From: Cynthia Foxwell Date: Wed, 25 May 2022 12:25:59 -0600 Subject: [PATCH] vim: add a bunch of plugins from some random dotfiles --- common/nvim/init.vim | 215 +++++++++++++++++++++++++++++++++++++++---- 1 file changed, 196 insertions(+), 19 deletions(-) diff --git a/common/nvim/init.vim b/common/nvim/init.vim index b497ccc..4b14c5b 100644 --- a/common/nvim/init.vim +++ b/common/nvim/init.vim @@ -2,9 +2,10 @@ call plug#begin(stdpath('data') . '/plugged') " color scheme -Plug 'owozsh/amora' +"Plug 'owozsh/amora' " misc +Plug 'nvim-lua/plenary.nvim' Plug 'tpope/vim-sensible' Plug 'itchyny/vim-gitbranch' Plug 'andweeb/presence.nvim' @@ -17,12 +18,20 @@ Plug 'mg979/vim-visual-multi' "Plug 'rrethy/vim-hexokinase', { 'do': 'make hexokinase' } Plug 'rhysd/committia.vim' Plug 'tpope/vim-sleuth' +Plug 'nvim-treesitter/nvim-treesitter' +Plug 'm-demare/hlargs.nvim' " interface Plug 'romgrk/barbar.nvim' Plug 'preservim/nerdtree' Plug 'Xuyuanp/nerdtree-git-plugin' -Plug 'adi/vim-indent-rainbow' +Plug 'lukas-reineke/indent-blankline.nvim' +Plug 'folke/lsp-colors.nvim' +Plug 'nacro90/numb.nvim' +Plug 'xiyaowong/nvim-cursorword' +Plug 'simrat39/symbols-outline.nvim' +Plug 'kevinhwang91/nvim-hlslens' +Plug 'SmiteshP/nvim-gps' " language specific Plug 'sheerun/vim-polyglot' @@ -31,6 +40,19 @@ Plug 'sheerun/vim-polyglot' Plug 'dense-analysis/ale' Plug 'neovim/nvim-lspconfig' Plug 'nvim-lua/completion-nvim' +Plug 'windwp/nvim-ts-autotag' +Plug 'jose-elias-alvarez/null-ls.nvim' + +Plug 'hrsh7th/nvim-cmp' +Plug 'hrsh7th/cmp-nvim-lsp' +Plug 'hrsh7th/cmp-cmdline' +Plug 'hrsh7th/cmp-buffer' +Plug 'dmitmel/cmp-cmdline-history' +Plug 'hrsh7th/cmp-nvim-lsp-signature-help' +Plug 'hrsh7th/cmp-path' + +Plug 'hrsh7th/cmp-vsnip' +Plug 'hrsh7th/vim-vsnip' call plug#end() @@ -82,28 +104,173 @@ let g:Hexokinase_highlighters = ['virtual'] set fillchars+=vert:▎ -lua << EOF -local lspconfig = require("lspconfig") -local completion_callback = require("completion").on_attach - -lspconfig.eslint.setup({on_attach = completion_callback}) -lspconfig.tsserver.setup({on_attach = completion_callback}) -EOF - set completeopt=menuone,noinsert,noselect set shortmess+=c let g:completion_enable_auto_popup = 1 -let g:rainbow_colors_color = [11, 10, 13, 12] -let g:rainbow_colors_black = [11, 10, 13, 12] -fun! EnableRainbowIndent() - if &ft =~ 'fugitive\|nerdtree' - return - endif - call rainbow#enable() -endfun -autocmd WinEnter,VimEnter * call EnableRainbowIndent() +lua << EOF +vim.cmd("highlight IndentBlanklineIndent1 ctermfg=11 cterm=nocombine") +vim.cmd("highlight IndentBlanklineIndent2 ctermfg=10 cterm=nocombine") +vim.cmd("highlight IndentBlanklineIndent3 ctermfg=13 cterm=nocombine") +vim.cmd("highlight IndentBlanklineIndent4 ctermfg=12 cterm=nocombine") + +vim.opt.list = true +vim.opt.listchars:append("space:⋅") +vim.opt.listchars:append("eol:↴") + +require("indent_blankline").setup( + { + char = "▎", + space_char_blankline = " ", + char_blankline = " ", + char_highlight_list = { + "IndentBlanklineIndent1", + "IndentBlanklineIndent2", + "IndentBlanklineIndent3", + "IndentBlanklineIndent4", + }, + show_current_context = true, + show_current_context_start = true, + } +) +EOF + +:lua require("numb").setup() +:lua require("nvim-ts-autotag").setup() + +lua << EOF +require("hlslens").setup( + { + calm_down = true, + nearest_only = true, + nearest_float_when = "auto", + } +) +EOF + +lua << EOF +local null_ls = require("null-ls") +null_ls.setup( + { + sources = { + null_ls.builtins.diagnostics.eslint, + null_ls.builtins.diagnostics.zsh, + null_ls.builtins.formatting.eslint, + null_ls.builtins.formatting.prettier, + } + } +) +EOF + +set completeopt=menu,menuone,noselect + +lua <'] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.abort(), + [''] = cmp.mapping.confirm({select = true}), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif vim.fn["vsnip#available"](1) == 1 then + feedkey("(vsnip-expand-or-jump)", "") + elseif has_words_before() then + cmp.complete() + else + fallback() -- The fallback function sends a already mapped key. In this case, it's probably ``. + end + end, { "i", "s" }), + [""] = cmp.mapping(function() + if cmp.visible() then + cmp.select_prev_item() + elseif vim.fn["vsnip#jumpable"](-1) == 1 then + feedkey("(vsnip-jump-prev)", "") + end + end, { "i", "s" }), +} + +cmp.setup( + { + snippet = { + expand = function(args) + vim.fn["vsnip#anonymous"](args.body) + end, + }, + mapping = cmp.mapping.preset.insert(mapping), + sources = cmp.config.sources( + { + {name = "nvim_lsp"}, + {name = "vsnip"}, + }, + { + {name = "buffer"}, + } + ), + } +) + +cmp.setup.cmdline( + ":", + { + sources = { + {name = "cmdline", group_index = 1}, + {name = "cmdline_history", group_index = 2}, + }, + mapping = cmp.mapping.preset.insert(mapping), + } +) + +cmp.setup.cmdline( + "/", + { + sources = { + {name = "cmdline_history"}, + {name = "buffer"}, + }, + mapping = cmp.mapping.preset.insert(mapping), + } +) + +local lspconfig = require("lspconfig") +local completion_callback = require("completion").on_attach +local capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities()) + +lspconfig.eslint.setup( + { + on_attach = completion_callback, + capabilities = capabilities, + } +) +lspconfig.tsserver.setup( + { + on_attach = completion_callback, + capabilities = capabilities, + } +) + +EOF + +lua <