refactor(nvim): replace fuzzy_buffer with ripgrep source in cmp

This commit is contained in:
Price Hiller 2023-11-04 15:45:56 -05:00
parent 153d7a0320
commit aceeffc329
Signed by: Price
SSH Key Fingerprint: SHA256:Y4S9ZzYphRn1W1kbJerJFO6GGsfu9O70VaBSxJO7dF8

View File

@ -33,10 +33,6 @@ return {
ft = "toml", ft = "toml",
config = true, config = true,
}, },
{
"tzachar/cmp-fuzzy-buffer",
dependencies = { "hrsh7th/nvim-cmp", "tzachar/fuzzy.nvim" },
},
}, },
config = function() config = function()
local cmp = require("cmp") local cmp = require("cmp")
@ -113,7 +109,6 @@ return {
local default_sources = { local default_sources = {
{ name = "nvim_lsp", priority = 11 }, { name = "nvim_lsp", priority = 11 },
{ name = "luasnip", priority = 10 }, -- For luasnip users. { name = "luasnip", priority = 10 }, -- For luasnip users.
{ name = "fuzzy_buffer", priority = 9, keyword_length = 3, max_item_count = 10 },
{ {
name = "rg", name = "rg",
priority = 7, priority = 7,
@ -141,7 +136,6 @@ return {
-- vim.notify(vim.inspect(entry)) -- vim.notify(vim.inspect(entry))
local selections = { local selections = {
["vim-dadbod-completion"] = { symbol = "󰆼 ", name = "DB", hl_group = "DadbodCompletion" }, ["vim-dadbod-completion"] = { symbol = "󰆼 ", name = "DB", hl_group = "DadbodCompletion" },
fuzzy_buffer = { symbol = "󰱼 ", name = "Buffer", hl_group = "Buffer" },
calc = { symbol = "", name = "Calculator", hl_group = "Calculator" }, calc = { symbol = "", name = "Calculator", hl_group = "Calculator" },
orgmode = { symbol = "", name = "Org", hl_group = "Orgmode" }, orgmode = { symbol = "", name = "Org", hl_group = "Orgmode" },
emoji = { symbol = "󰞅 ", name = "Emoji", hl_group = "Emoji" }, emoji = { symbol = "󰞅 ", name = "Emoji", hl_group = "Emoji" },
@ -322,7 +316,6 @@ return {
compare.offset, compare.offset,
compare.recently_used, compare.recently_used,
compare.exact, compare.exact,
require("cmp_fuzzy_buffer.compare"),
compare.kind, compare.kind,
compare.sort_text, compare.sort_text,
compare.length, compare.length,
@ -354,18 +347,18 @@ return {
-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore). -- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline("/", { cmp.setup.cmdline("/", {
mapping = cmp.mapping.preset.cmdline(), mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({ { name = "fuzzy_buffer" } }), sources = cmp.config.sources({ { name = "rg" } }),
}) })
cmp.setup.cmdline("?", { cmp.setup.cmdline("?", {
mapping = cmp.mapping.preset.cmdline(), mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({ { name = "fuzzy_buffer" } }), sources = cmp.config.sources({ { name = "rg" } }),
}) })
cmp.setup.cmdline("@", { cmp.setup.cmdline("@", {
mapping = cmp.mapping.preset.cmdline(), mapping = cmp.mapping.preset.cmdline(),
sources = cmp.config.sources({ sources = cmp.config.sources({
{ name = "fuzzy_buffer" }, { name = "rg" },
{ name = "cmdline_history", max_item_count = 3 }, { name = "cmdline_history", max_item_count = 3 },
}), }),
}) })
@ -381,7 +374,7 @@ return {
}, },
}, },
{ name = "cmdline_history", max_item_count = 3 }, { name = "cmdline_history", max_item_count = 3 },
{ name = "fuzzy_buffer" }, { name = "rg" },
}), }),
}) })
end, end,