vim: add a bunch of plugins from some random dotfiles
This commit is contained in:
parent
d4a06ae272
commit
dfcc4d85d8
1 changed files with 196 additions and 19 deletions
|
@ -2,9 +2,10 @@
|
||||||
call plug#begin(stdpath('data') . '/plugged')
|
call plug#begin(stdpath('data') . '/plugged')
|
||||||
|
|
||||||
" color scheme
|
" color scheme
|
||||||
Plug 'owozsh/amora'
|
"Plug 'owozsh/amora'
|
||||||
|
|
||||||
" misc
|
" misc
|
||||||
|
Plug 'nvim-lua/plenary.nvim'
|
||||||
Plug 'tpope/vim-sensible'
|
Plug 'tpope/vim-sensible'
|
||||||
Plug 'itchyny/vim-gitbranch'
|
Plug 'itchyny/vim-gitbranch'
|
||||||
Plug 'andweeb/presence.nvim'
|
Plug 'andweeb/presence.nvim'
|
||||||
|
@ -17,12 +18,20 @@ Plug 'mg979/vim-visual-multi'
|
||||||
"Plug 'rrethy/vim-hexokinase', { 'do': 'make hexokinase' }
|
"Plug 'rrethy/vim-hexokinase', { 'do': 'make hexokinase' }
|
||||||
Plug 'rhysd/committia.vim'
|
Plug 'rhysd/committia.vim'
|
||||||
Plug 'tpope/vim-sleuth'
|
Plug 'tpope/vim-sleuth'
|
||||||
|
Plug 'nvim-treesitter/nvim-treesitter'
|
||||||
|
Plug 'm-demare/hlargs.nvim'
|
||||||
|
|
||||||
" interface
|
" interface
|
||||||
Plug 'romgrk/barbar.nvim'
|
Plug 'romgrk/barbar.nvim'
|
||||||
Plug 'preservim/nerdtree'
|
Plug 'preservim/nerdtree'
|
||||||
Plug 'Xuyuanp/nerdtree-git-plugin'
|
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
|
" language specific
|
||||||
Plug 'sheerun/vim-polyglot'
|
Plug 'sheerun/vim-polyglot'
|
||||||
|
@ -31,6 +40,19 @@ Plug 'sheerun/vim-polyglot'
|
||||||
Plug 'dense-analysis/ale'
|
Plug 'dense-analysis/ale'
|
||||||
Plug 'neovim/nvim-lspconfig'
|
Plug 'neovim/nvim-lspconfig'
|
||||||
Plug 'nvim-lua/completion-nvim'
|
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()
|
call plug#end()
|
||||||
|
|
||||||
|
@ -82,28 +104,173 @@ let g:Hexokinase_highlighters = ['virtual']
|
||||||
|
|
||||||
set fillchars+=vert:▎
|
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 completeopt=menuone,noinsert,noselect
|
||||||
set shortmess+=c
|
set shortmess+=c
|
||||||
|
|
||||||
let g:completion_enable_auto_popup = 1
|
let g:completion_enable_auto_popup = 1
|
||||||
|
|
||||||
let g:rainbow_colors_color = [11, 10, 13, 12]
|
lua << EOF
|
||||||
let g:rainbow_colors_black = [11, 10, 13, 12]
|
vim.cmd("highlight IndentBlanklineIndent1 ctermfg=11 cterm=nocombine")
|
||||||
fun! EnableRainbowIndent()
|
vim.cmd("highlight IndentBlanklineIndent2 ctermfg=10 cterm=nocombine")
|
||||||
if &ft =~ 'fugitive\|nerdtree'
|
vim.cmd("highlight IndentBlanklineIndent3 ctermfg=13 cterm=nocombine")
|
||||||
return
|
vim.cmd("highlight IndentBlanklineIndent4 ctermfg=12 cterm=nocombine")
|
||||||
endif
|
|
||||||
call rainbow#enable()
|
vim.opt.list = true
|
||||||
endfun
|
vim.opt.listchars:append("space:⋅")
|
||||||
autocmd WinEnter,VimEnter * call EnableRainbowIndent()
|
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
|
" tre
|
||||||
let g:NERDTreeGitStatusIndicatorMapCustom = {
|
let g:NERDTreeGitStatusIndicatorMapCustom = {
|
||||||
|
@ -256,6 +423,8 @@ hi StatusLineGitBranch ctermbg=5 ctermfg=0
|
||||||
hi StatusLineChar ctermbg=4 ctermfg=0
|
hi StatusLineChar ctermbg=4 ctermfg=0
|
||||||
hi StatusLineFormat ctermbg=3 ctermfg=0
|
hi StatusLineFormat ctermbg=3 ctermfg=0
|
||||||
hi StatusLineFileType ctermbg=7 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('StatusLineMode', g:amora#palette.bgdark, g:amora#palette.red)
|
||||||
"call s:h('StatusLineGitBranch', g:amora#palette.bgdark, g:amora#palette.pink)
|
"call s:h('StatusLineGitBranch', g:amora#palette.bgdark, g:amora#palette.pink)
|
||||||
|
@ -288,6 +457,11 @@ function! GitBranch()
|
||||||
return strlen(l:branch) ? ' ' . l:branch . ' ' : ''
|
return strlen(l:branch) ? ' ' . l:branch . ' ' : ''
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! Breadcrumbs()
|
||||||
|
return luaeval('require("nvim-gps").is_available()') ? ' '.luaeval('require("nvim-gps").get_location()').' ' : ''
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
set statusline=
|
set statusline=
|
||||||
set statusline+=%#StatusLineMode#
|
set statusline+=%#StatusLineMode#
|
||||||
set statusline+=%{GetMode()}
|
set statusline+=%{GetMode()}
|
||||||
|
@ -295,8 +469,11 @@ set statusline+=%#StatusLineGitBranch#
|
||||||
set statusline+=%{GitBranch()}
|
set statusline+=%{GitBranch()}
|
||||||
set statusline+=%*
|
set statusline+=%*
|
||||||
set statusline+=\ %f
|
set statusline+=\ %f
|
||||||
|
set statusline+=%#StatusLineEmpty#
|
||||||
set statusline+=\ %m%r
|
set statusline+=\ %m%r
|
||||||
set statusline+=%=
|
set statusline+=%=
|
||||||
|
set statusline+=%#StatusLineBreadcrumbs#
|
||||||
|
set statusline+=%{Breadcrumbs()}
|
||||||
set statusline+=%#StatusLineChar#
|
set statusline+=%#StatusLineChar#
|
||||||
set statusline+=\ %l,\ %c\
|
set statusline+=\ %l,\ %c\
|
||||||
set statusline+=%#StatusLineFormat#
|
set statusline+=%#StatusLineFormat#
|
||||||
|
|
Loading…
Reference in a new issue