vim: add a bunch of plugins from some random dotfiles

This commit is contained in:
Cynthia Foxwell 2022-05-25 12:25:59 -06:00
parent d4a06ae272
commit dfcc4d85d8

View file

@ -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 <<EOF
local cmp = require("cmp")
local has_words_before = function()
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
end
local feedkey = function(key, mode)
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes(key, true, true, true), mode, true)
end
local mapping = {
['<C-b>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete(),
['<C-e>'] = cmp.mapping.abort(),
['<CR>'] = cmp.mapping.confirm({select = true}),
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif vim.fn["vsnip#available"](1) == 1 then
feedkey("<Plug>(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 `<Tab>`.
end
end, { "i", "s" }),
["<S-Tab>"] = cmp.mapping(function()
if cmp.visible() then
cmp.select_prev_item()
elseif vim.fn["vsnip#jumpable"](-1) == 1 then
feedkey("<Plug>(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 <<EOF
require("nvim-gps").setup(
{
disable_icons = true,
}
)
EOF
" tre
let g:NERDTreeGitStatusIndicatorMapCustom = {
@ -256,6 +423,8 @@ hi StatusLineGitBranch ctermbg=5 ctermfg=0
hi StatusLineChar ctermbg=4 ctermfg=0
hi StatusLineFormat ctermbg=3 ctermfg=0
hi StatusLineFileType ctermbg=7 ctermfg=0
hi StatusLineBreadcrumbs ctermbg=6 ctermfg=0
hi StatusLineEmpty ctermbg=8 ctermfg=2
"call s:h('StatusLineMode', g:amora#palette.bgdark, g:amora#palette.red)
"call s:h('StatusLineGitBranch', g:amora#palette.bgdark, g:amora#palette.pink)
@ -288,6 +457,11 @@ function! GitBranch()
return strlen(l:branch) ? ' ' . l:branch . ' ' : ''
endfunction
function! Breadcrumbs()
return luaeval('require("nvim-gps").is_available()') ? ' '.luaeval('require("nvim-gps").get_location()').' ' : ''
endfunction
set statusline=
set statusline+=%#StatusLineMode#
set statusline+=%{GetMode()}
@ -295,8 +469,11 @@ set statusline+=%#StatusLineGitBranch#
set statusline+=%{GitBranch()}
set statusline+=%*
set statusline+=\ %f
set statusline+=%#StatusLineEmpty#
set statusline+=\ %m%r
set statusline+=%=
set statusline+=%#StatusLineBreadcrumbs#
set statusline+=%{Breadcrumbs()}
set statusline+=%#StatusLineChar#
set statusline+=\ %l,\ %c\
set statusline+=%#StatusLineFormat#