Add rust tools
This commit is contained in:
parent
790777c009
commit
36bd3ea0e9
|
@ -7,5 +7,6 @@
|
|||
"nvim-web-devicons": { "branch": "master", "commit": "9ab9b0b894b2388a9dbcdee5f00ce72e25d85bf9" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "bda256fab0eb66a15e8190937e417e6a14ee5d72" },
|
||||
"presence.nvim": { "branch": "main", "commit": "87c857a56b7703f976d3a5ef15967d80508df6e6" },
|
||||
"rust-tools.nvim": { "branch": "master", "commit": "71d2cf67b5ed120a0e31b2c8adb210dd2834242f" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "276362a8020c6e94c7a76d49aa00d4923b0c02f3" }
|
||||
}
|
23
nvim/lua/configs/rust-tools.lua
Normal file
23
nvim/lua/configs/rust-tools.lua
Normal file
|
@ -0,0 +1,23 @@
|
|||
return function()
|
||||
local rt = require "rust-tools"
|
||||
rt.setup({
|
||||
server = {
|
||||
on_attach = function(client, bufnr)
|
||||
vim.keymap.set('n', "<C-space>", rt.hover_actions.hover_actions, { buffer = bufnr })
|
||||
vim.keymap.set('n', "<Leader>a", rt.code_action_group.code_action_group, { buffer = bufnr })
|
||||
|
||||
local buf_opts = { noremap = true, silent = true, buffer = buf_number }
|
||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover, buf_opts)
|
||||
end,
|
||||
["rust-analyzer"] = {
|
||||
cargo = { allFeatures = true },
|
||||
checkOnSave = {
|
||||
-- default: `cargo check`
|
||||
command = "clippy",
|
||||
allFeatures = true,
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
end
|
||||
|
|
@ -17,3 +17,10 @@ vim.filetype.add({
|
|||
}
|
||||
})
|
||||
|
||||
-- Workaround: https://github.com/neovim/neovim/issues/21856
|
||||
vim.api.nvim_create_autocmd({ "VimLeave" }, {
|
||||
callback = function()
|
||||
vim.fn.jobstart('notify-send "hello"', {detach=true})
|
||||
end,
|
||||
})
|
||||
|
||||
|
|
|
@ -7,6 +7,10 @@ return {
|
|||
"neovim/nvim-lspconfig",
|
||||
config = require "configs/lspconfig",
|
||||
},
|
||||
{
|
||||
"simrat39/rust-tools.nvim",
|
||||
config = require "configs/rust-tools",
|
||||
},
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
config = require "configs/treesitter",
|
||||
|
|
Loading…
Reference in a new issue