Reshape cmp box

This commit is contained in:
Alessandro
2024-09-24 10:03:45 +02:00
parent 44ae4fbc45
commit 9f4b4c111d
6 changed files with 47 additions and 24 deletions

20
nvim/lua/configs/cmp.lua Normal file
View File

@@ -0,0 +1,20 @@
local cmp_ui = require("nvconfig").ui.cmp
return {
formatting = {
-- default fields order i.e completion word + item.kind + item.kind icons
fields = { "abbr", "kind" },
format = function(_, item)
local icons = require "nvchad.icons.lspkind"
local icon = (cmp_ui.icons and icons[item.kind]) or ""
icon = cmp_ui.lspkind_text and (" " .. icon .. " ") or icon
item.kind = string.format("%s %s", icon, cmp_ui.lspkind_text and item.kind or "")
item.abbr = item.abbr:match "[^(]+"
item.menu = ""
return item
end,
},
}

View File

@@ -43,8 +43,8 @@ map("n", "gi", vim.lsp.buf.implementation, { desc = "Go to implementation" })
map("n", "gr", vim.lsp.buf.references, { desc = "Show references" })
map("n", "<leader>ld", vim.diagnostic.setloclist, { desc = "LSP Diagnostic loclist" })
map("n", "<leader>lr", function()
require "nvchad.lsp.renamer"()
end, {desc = "NvRenamer"})
require "nvchad.lsp.renamer"()
end, { desc = "NvRenamer" })
-- Git
map("n", "<leader>gm", "<cmd>Telescope git_commits<CR>", { desc = "telescope git commits" })
@@ -81,4 +81,3 @@ cmp.setup {
["<Up>"] = cmp.mapping(cmp.mapping.select_prev_item { behavior = cmp.SelectBehavior.Select }, { "i" }),
},
}

View File

@@ -22,4 +22,4 @@ vim.opt.fillchars = {
foldclose = "",
}
vim.o.pumheight = 10

View File

@@ -27,4 +27,8 @@ return {
"nvim-tree/nvim-tree.lua",
opts = require "configs.nvim-tree",
},
{
"hrsh7th/nvim-cmp",
opts = require("configs.cmp"),
},
}

View File

@@ -2,7 +2,7 @@ return {
"kevinhwang91/nvim-ufo",
config = function()
require("ufo").setup {
provider_selector = function(bufnr, filetype, buftype)
provider_selector = function(_, _, _)
return { "treesitter", "indent" }
end,
}