chore(nvim): harpoon and other efficiency stuff

This commit is contained in:
Afonso Franco 2024-04-27 16:02:41 +01:00
parent f4fb84348d
commit 9c6e3a5d18
Signed by: afonso
SSH key fingerprint: SHA256:gkVPzsQQJzqi21ntQBV6pXTx4bYI53rFGI4XtvCpwd4
6 changed files with 122 additions and 124 deletions

View file

@ -19,38 +19,6 @@ if not lspkind_status_ok then
return
end
-- 󰃐 󰆩 󰙅 󰛡  󰅲 some other good icons
local kind_icons = {
Text = "󰉿",
Method = "m",
Function = "󰊕",
Constructor = "",
Field = "",
Variable = "󰆧",
Class = "󰌗",
Interface = "",
Module = "",
Property = "",
Unit = "",
Value = "󰎠",
Enum = "",
Keyword = "󰌋",
Snippet = "",
Color = "󰏘",
File = "󰈙",
Reference = "",
Folder = "󰉋",
EnumMember = "",
Constant = "󰇽",
Struct = "",
Event = "",
Operator = "󰆕",
TypeParameter = "󰊄",
Copilot = "",
DB = "󰆼",
}
-- find more here: https://www.nerdfonts.com/cheat-sheet
cmp.setup({
snippet = {
expand = function(args)
@ -71,38 +39,25 @@ cmp.setup({
{ "i", "c" }
),
["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }),
-- Accept currently selected item. If none selected, do nothing.
["<C-k>"] = cmp.mapping(function(fallback)
if luasnip.expandable() then
luasnip.expand()
elseif luasnip.expand_or_jumpable() then
["<C-l>"] = cmp.mapping(function()
if luasnip.expand_or_jumpable() then
luasnip.expand_or_jump()
elseif check_backspace() then
fallback()
else
fallback()
end
end),
["<C-j>"] = cmp.mapping(function(fallback)
["<C-h>"] = cmp.mapping(function()
if luasnip.jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end),
},
formatting = {
fields = { "kind", "abbr", "menu" },
format = lspkind.cmp_format({
mode = "symbol_text", -- show only symbol annotations
maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters)
-- can also be a function to dynamically calculate max width such as
-- maxwidth = function() return math.floor(0.45 * vim.o.columns) end,
ellipsis_char = "...", -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead (must define maxwidth first)
show_labelDetails = true, -- show labelDetails in menu. Disabled by default
mode = "symbol_text",
maxwidth = 50,
ellipsis_char = "...",
show_labelDetails = true,
-- The function below will be called before any actual modifications from lspkind
-- so that you can provide more controls on popup customization. (See [#30](https://github.com/onsails/lspkind-nvim/pull/30))
before = function(entry, vim_item)
vim_item.menu = ({
nvim_lsp = "[LSP]",
@ -113,11 +68,16 @@ cmp.setup({
end,
}),
},
preselect = cmp.PreselectMode.None,
sorting = {
priority_weight = 2,
comparators = {
cmp.config.compare.exact,
cmp.config.compare.offset,
cmp.config.compare.exact,
cmp.config.compare.score,
cmp.config.compare.kind,
cmp.config.compare.recently_used,
cmp.config.compare.locality,
--Make entries that start with underline appear after
function(entry1, entry2)
@ -134,8 +94,8 @@ cmp.setup({
},
},
sources = cmp.config.sources({
{ name = "nvim_lsp" },
{ name = "nvim_lua" },
{ name = "nvim_lsp" },
{ name = "luasnip" },
{ name = "path" },
}, {