UPDATED init.lue to ADD 'simrat39/rust-tools.nvim' rust tooling plugin.
This commit is contained in:
parent
acac8fe6cc
commit
0f8c06b6fd
96
init.lua
96
init.lua
|
@ -1144,6 +1144,102 @@ require('lazy').setup({
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
'simrat39/rust-tools.nvim',
|
||||||
|
dependencies = {
|
||||||
|
'neovim/nvim-lspconfig',
|
||||||
|
'nvim-lua/plenary.nvim',
|
||||||
|
'mfussenegger/nvim-dap',
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
local rt = require 'rust-tools'
|
||||||
|
|
||||||
|
rt.setup {
|
||||||
|
server = {
|
||||||
|
-- Standalone file support
|
||||||
|
standalone = true,
|
||||||
|
|
||||||
|
-- Pass in your existing rust_analyzer settings
|
||||||
|
settings = {
|
||||||
|
['rust-analyzer'] = {
|
||||||
|
cargo = {
|
||||||
|
allFeatures = true,
|
||||||
|
loadOutDirsFromCheck = true,
|
||||||
|
runBuildScripts = true,
|
||||||
|
},
|
||||||
|
-- Add clippy lints for better code suggestions
|
||||||
|
checkOnSave = {
|
||||||
|
command = 'clippy',
|
||||||
|
extraArgs = { '--no-deps' },
|
||||||
|
},
|
||||||
|
procMacro = {
|
||||||
|
enable = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Configure LSP handlers
|
||||||
|
on_attach = function(_, bufnr)
|
||||||
|
-- Hover actions
|
||||||
|
vim.keymap.set('n', 'K', rt.hover_actions.hover_actions, { buffer = bufnr, desc = 'Rust: Hover Actions' })
|
||||||
|
|
||||||
|
-- Code action groups
|
||||||
|
vim.keymap.set('n', '<Leader>ra', rt.code_action_group.code_action_group, { buffer = bufnr, desc = 'Rust: Code [A]ction Group' })
|
||||||
|
|
||||||
|
-- Moving items
|
||||||
|
vim.keymap.set('n', '<Leader>rmj', function()
|
||||||
|
rt.move_item.move_item(false)
|
||||||
|
end, { buffer = bufnr, desc = 'Rust: Move Item Down' })
|
||||||
|
vim.keymap.set('n', '<Leader>rmk', function()
|
||||||
|
rt.move_item.move_item(true)
|
||||||
|
end, { buffer = bufnr, desc = 'Rust: Move Item Up' })
|
||||||
|
|
||||||
|
-- Debugging
|
||||||
|
vim.keymap.set('n', '<Leader>rdd', rt.debuggables.debuggables, { buffer = bufnr, desc = 'Rust: [D]ebuggables' })
|
||||||
|
vim.keymap.set('n', '<Leader>rr', rt.runnables.runnables, { buffer = bufnr, desc = 'Rust: [R]unnables' })
|
||||||
|
|
||||||
|
-- Expand macros
|
||||||
|
vim.keymap.set('n', '<Leader>rem', rt.expand_macro.expand_macro, { buffer = bufnr, desc = 'Rust: [E]xpand [M]acro' })
|
||||||
|
|
||||||
|
-- Parent modules
|
||||||
|
vim.keymap.set('n', '<Leader>rpp', rt.parent_module.parent_module, { buffer = bufnr, desc = 'Rust: [P]arent Module' })
|
||||||
|
|
||||||
|
-- Join lines
|
||||||
|
vim.keymap.set('n', '<Leader>rj', rt.join_lines.join_lines, { buffer = bufnr, desc = 'Rust: [J]oin Lines' })
|
||||||
|
|
||||||
|
-- SSR (Structural Search Replace)
|
||||||
|
vim.keymap.set('n', '<Leader>rss', rt.ssr.ssr, { buffer = bufnr, desc = 'Rust: [S]tructural [S]earch [R]eplace' })
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Set dap adapter if using nvim-dap
|
||||||
|
dap = {
|
||||||
|
adapter = {
|
||||||
|
type = 'executable',
|
||||||
|
command = 'lldb-vscode',
|
||||||
|
name = 'rt_lldb',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Tools configuration
|
||||||
|
tools = {
|
||||||
|
-- Automatically set inlay hints
|
||||||
|
autoSetHints = true,
|
||||||
|
|
||||||
|
-- Hover actions configuration
|
||||||
|
hover_actions = {
|
||||||
|
auto_focus = true,
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Code action groups configuration
|
||||||
|
code_action_group = {
|
||||||
|
auto_focus = true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
},
|
||||||
}, {
|
}, {
|
||||||
ui = {
|
ui = {
|
||||||
-- If you are using a Nerd Font: set icons to an empty table which will use the
|
-- If you are using a Nerd Font: set icons to an empty table which will use the
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
"LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" },
|
"LuaSnip": { "branch": "master", "commit": "03c8e67eb7293c404845b3982db895d59c0d1538" },
|
||||||
"blink.cmp": { "branch": "main", "commit": "cb5e346d9e0efa7a3eee7fd4da0b690c48d2a98e" },
|
"blink.cmp": { "branch": "main", "commit": "cb5e346d9e0efa7a3eee7fd4da0b690c48d2a98e" },
|
||||||
"conform.nvim": { "branch": "master", "commit": "372fc521f8421b7830ea6db4d6ea3bae1c77548c" },
|
"conform.nvim": { "branch": "master", "commit": "372fc521f8421b7830ea6db4d6ea3bae1c77548c" },
|
||||||
|
"crates.nvim": { "branch": "main", "commit": "73d2c590c74a0c582144987a4decb4a642755859" },
|
||||||
"fidget.nvim": { "branch": "main", "commit": "d9ba6b7bfe29b3119a610892af67602641da778e" },
|
"fidget.nvim": { "branch": "main", "commit": "d9ba6b7bfe29b3119a610892af67602641da778e" },
|
||||||
"gitsigns.nvim": { "branch": "main", "commit": "140ac646db125904e456e42ab8b538d28f9607d7" },
|
"gitsigns.nvim": { "branch": "main", "commit": "140ac646db125904e456e42ab8b538d28f9607d7" },
|
||||||
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
|
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
|
||||||
|
|
Loading…
Reference in New Issue