Files
nvim-config-old/lua/plugins/rust.lua
2025-09-19 19:57:27 +02:00

49 lines
1.2 KiB
Lua

return {
"mrcjkb/rustaceanvim",
version = "^5", -- Recommended
lazy = false, -- This plugin is already lazy
config = function()
vim.g.rustaceanvim = {
-- Plugin configuration
tools = {},
-- LSP configuration
server = {
capabilities = {
textDocument = {
completion = {
completionItem = {
snippetSupport = false,
},
},
},
},
on_attach = function(client, bufnr)
-- you can also put keymaps in here
vim.keymap.set("n", "<leader>ca", function()
vim.cmd.RustLsp("codeAction") -- supports rust-analyzer's grouping
-- or vim.lsp.buf.codeAction() if you don't want grouping.
end, { silent = true, buffer = bufnr })
vim.keymap.set(
"n",
"<leader>t", -- Override Neovim's built-in hover keymap with rustaceanvim's hover actions
function()
vim.cmd.RustLsp({ "renderDiagnostic", "current" }) -- defaults to 'cycle'
end,
{ silent = true, buffer = bufnr }
)
end,
default_settings = {
-- rust-analyzer language server configuration
["rust-analyzer"] = {
check = {
command = "clippy",
},
},
},
},
-- DAP configuration
dap = {},
}
end,
}