Update plugins so it matches the new plugin collection of lazyvim

This fixes lsp autocomplete.
This commit is contained in:
Marcelo Jacobus 2025-01-10 13:46:27 -03:00
parent 48e9b425dd
commit cb8db79f8a
5 changed files with 9 additions and 95 deletions

View file

@ -32,6 +32,9 @@ local plugins = {
{ import = "lazyvim.plugins.extras.coding.luasnip" },
{ import = "lazyvim.plugins.extras.coding.neogen" }, -- generate annotations
{ import = "lazyvim.plugins.extras.ai.copilot" },
-- { import = "lazyvim.plugins.extras.coding.nvim-cmp" },
{ import = "lazyvim.plugins.extras.ui.treesitter-context" },
{ import = "lazyvim.plugins.extras.editor.harpoon2" },

View file

@ -1,3 +0,0 @@
return {
{ "nvimdev/dashboard-nvim", enabled = false },
}

View file

@ -1,4 +0,0 @@
return {
"rcarriga/nvim-notify",
enabled = false,
}

View file

@ -1,88 +0,0 @@
local supertab = function(opts)
local has_words_before = function()
local line, col = unpack(vim.api.nvim_win_get_cursor(0))
if col == 0 then
return false
end
local line_text = vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]
local char_before_cursor = line_text:sub(col, col)
return not char_before_cursor:match("%s") or char_before_cursor:match("[./]")
end
local cmp = require("cmp")
local prev = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif vim.snippet.active({ direction = -1 }) then
vim.schedule(function()
vim.snippet.jump(-1)
end)
else
fallback()
end
end, { "i", "s" })
opts.mapping = vim.tbl_extend("force", opts.mapping, {
["<Tab>"] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif vim.snippet.active({ direction = 1 }) then
vim.schedule(function()
vim.snippet.jump(1)
end)
elseif has_words_before() then
cmp.complete()
else
fallback()
end
end, { "i", "s" }),
["<S-Tab>"] = prev,
})
end
local function sources(opts)
opts.sources = vim.tbl_extend("force", opts.sources or {}, {
{
name = "path",
option = {
trailing_slash = true, -- Adds a trailing slash to directories
},
},
{ name = "buffer" },
})
end
local function format(opts)
opts.formatting = {
format = function(entry, vim_item)
vim_item.menu = ({
buffer = "[Buffer]",
nvim_lsp = "[LSP]",
path = "[Path]",
})[entry.source.name]
return vim_item
end,
}
opts.window = {
completion = require("cmp").config.window.bordered(),
documentation = require("cmp").config.window.bordered(),
}
end
return {
{
"hrsh7th/nvim-cmp",
opts = function(_, opts)
supertab(opts)
format(opts)
sources(opts)
-- Force `cmp-path` to trigger more aggressively
opts.completion = {
keyword_length = 1, -- Trigger after typing 1 character
keyword_pattern = [[\%(\k\|[./]\)\+]], -- Match paths and keywords
}
end,
},
}

6
lua/plugins/slacks.lua Normal file
View file

@ -0,0 +1,6 @@
return {
{ "folke/snacks.nvim", opts = {
dashboard = { enabled = false },
notifier = { enabled = false },
} },
}