re-structure neovim plugins
also delete unused ones
This commit is contained in:
parent
ea5957f6d4
commit
071be15dc1
47 changed files with 155 additions and 274 deletions
120
config/nvim/lua/aleidk/plugins-ide/completion.lua
Normal file
120
config/nvim/lua/aleidk/plugins-ide/completion.lua
Normal file
|
|
@ -0,0 +1,120 @@
|
|||
---@diagnostic disable: missing-fields
|
||||
return {
|
||||
"hrsh7th/nvim-cmp",
|
||||
version = false, -- last release is way too old
|
||||
event = "InsertEnter",
|
||||
dependencies = {
|
||||
"L3MON4D3/LuaSnip",
|
||||
"davidsierradz/cmp-conventionalcommits",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-cmdline",
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-path",
|
||||
"petertriho/cmp-git",
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
"windwp/nvim-autopairs",
|
||||
{
|
||||
"zbirenbaum/copilot-cmp",
|
||||
config = function()
|
||||
require("copilot_cmp").setup()
|
||||
end
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
vim.api.nvim_set_hl(0, "CmpGhostText", { link = "Comment", default = true })
|
||||
local cmp = require("cmp")
|
||||
|
||||
local cmp_autopairs = require("nvim-autopairs.completion.cmp")
|
||||
cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done())
|
||||
|
||||
local defaults = require("cmp.config.default")()
|
||||
local window_opts = {
|
||||
border = "rounded",
|
||||
side_padding = 1,
|
||||
-- fix colors for catppuccin colorscheme
|
||||
winhighlight = "Normal:Pmenu,FloatBorder:FloatBorder,CursorLine:PmenuSel,Search:None",
|
||||
}
|
||||
local opts = {
|
||||
visible_docs = false,
|
||||
completion = {
|
||||
completeopt = "menu,menuone,noinsert",
|
||||
},
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require("luasnip").lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
["<C-n>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }),
|
||||
["<C-p>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }),
|
||||
["<C-j>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }),
|
||||
["<C-k>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }),
|
||||
["<C-u>"] = cmp.mapping.scroll_docs(-4),
|
||||
["<C-d>"] = cmp.mapping.scroll_docs(4),
|
||||
["<C-o>"] = function()
|
||||
if cmp.visible_docs() then
|
||||
cmp.close_docs()
|
||||
else
|
||||
cmp.open_docs()
|
||||
end
|
||||
end,
|
||||
["<C-Space>"] = cmp.mapping.complete(),
|
||||
["<C-e>"] = cmp.mapping.abort(),
|
||||
["<BR>"] = cmp.mapping.abort(),
|
||||
["<C-CR>"] = cmp.mapping.confirm({ select = false }), -- Confirm only if selected an item
|
||||
["<CR>"] = cmp.mapping.confirm({
|
||||
-- Auto confirms first item
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = true,
|
||||
}),
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = "conventionalcommits" },
|
||||
{ name = "copilot" },
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "buffer" },
|
||||
{ name = "path" },
|
||||
}),
|
||||
formatting = {
|
||||
fields = { "kind", "abbr", "menu" },
|
||||
format = function(_, item)
|
||||
local icons = require("aleidk.constants").icons.kinds
|
||||
if icons[item.kind] then
|
||||
item.kind = icons[item.kind] .. item.kind
|
||||
end
|
||||
return item
|
||||
end,
|
||||
},
|
||||
window = {
|
||||
completion = cmp.config.window.bordered(window_opts),
|
||||
documentation = cmp.config.window.bordered(window_opts),
|
||||
},
|
||||
experimental = {
|
||||
ghost_text = {
|
||||
hl_group = "CmpGhostText",
|
||||
},
|
||||
},
|
||||
sorting = {
|
||||
priority_weight = 2,
|
||||
comparators = {
|
||||
require("copilot_cmp.comparators").prioritize,
|
||||
|
||||
-- Below is the default comparitor list and order for nvim-cmp
|
||||
cmp.config.compare.offset,
|
||||
-- cmp.config.compare.scopes, --this is commented in nvim-cmp too
|
||||
cmp.config.compare.exact,
|
||||
cmp.config.compare.score,
|
||||
cmp.config.compare.recently_used,
|
||||
cmp.config.compare.locality,
|
||||
cmp.config.compare.kind,
|
||||
cmp.config.compare.sort_text,
|
||||
cmp.config.compare.length,
|
||||
cmp.config.compare.order,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
cmp.setup(opts)
|
||||
end,
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue