feat(nvim): improve creates.nvim setup
All checks were successful
Check Formatting of Files / Check-Formatting (push) Successful in 1m2s

This commit is contained in:
Price Hiller 2024-07-26 03:44:53 -05:00
parent 187e87757b
commit 3f0637772f
Signed by: Price
GPG Key ID: C3FADDE7A8534BEB
2 changed files with 25 additions and 8 deletions

View File

@ -62,12 +62,6 @@ return {
"saadparwaiz1/cmp_luasnip", "saadparwaiz1/cmp_luasnip",
}, },
}, },
{
"saecki/crates.nvim",
dependencies = { "nvim-lua/plenary.nvim" },
ft = "toml",
config = true,
},
}, },
config = function() config = function()
local cmp = require("cmp") local cmp = require("cmp")
@ -187,7 +181,7 @@ return {
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" },
zsh = { symbol = "", name = "Zsh", hl_group = "Zsh" }, zsh = { symbol = "", name = "Zsh", hl_group = "Zsh" },
crates = { symbol = "", name = "Crates", hl_group = "Crates" }, ["crates.nvim"] = { symbol = "", name = "Crates", hl_group = "Crates" },
cmdline_history = { symbol = "", name = "Cmd History", hl_group = "CmdHistory" }, cmdline_history = { symbol = "", name = "Cmd History", hl_group = "CmdHistory" },
rg = { symbol = "", name = "Ripgrep", hl_group = "Ripgrep" }, rg = { symbol = "", name = "Ripgrep", hl_group = "Ripgrep" },
fuzzy_buffer = { symbol = "󰱼 ", name = "Buffer", hl_group = "Buffer" }, fuzzy_buffer = { symbol = "󰱼 ", name = "Buffer", hl_group = "Buffer" },
@ -205,6 +199,7 @@ return {
local selection local selection
local lsp_name local lsp_name
-- vim.notify(vim.inspect(entry.source))
if entry.source.name == "nvim_lsp" then if entry.source.name == "nvim_lsp" then
lsp_name = entry.source.source.client.name lsp_name = entry.source.source.client.name
selection = selections[lsp_name] selection = selections[lsp_name]
@ -438,7 +433,6 @@ return {
"plsql", "plsql",
{ sources = standard_sources({ { name = "vim-dadbod-completion", priority = 20 } }) } { sources = standard_sources({ { name = "vim-dadbod-completion", priority = 20 } }) }
) )
cmp.setup.filetype("toml", { sources = standard_sources({ { name = "crates" } }) })
cmp.setup.filetype("org", { sources = standard_sources({ { name = "orgmode", priority = 20 } }) }) cmp.setup.filetype("org", { sources = standard_sources({ { name = "orgmode", priority = 20 } }) })
-- 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).

View File

@ -0,0 +1,23 @@
return {
{
"saecki/crates.nvim",
event = { "BufRead Cargo.toml" },
config = function()
require("crates").setup({
lsp = {
enabled = true,
actions = true,
completion = true,
hover = true,
},
completion = {
crates = {
enabled = true,
max_results = 8,
min_chars = 2,
},
},
})
end,
},
}