migrate to dotter
This commit is contained in:
parent
c5618f2f2c
commit
23b6c0a596
265 changed files with 62 additions and 3125 deletions
35
configs/nvim/after/ftplugin/rust.lua
Normal file
35
configs/nvim/after/ftplugin/rust.lua
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
local rust = vim.cmd.RustLsp
|
||||
|
||||
-- Override some LSP mappings
|
||||
|
||||
local function opts(desc)
|
||||
return {
|
||||
silent = true,
|
||||
buffer = vim.api.nvim_get_current_buf(),
|
||||
desc = desc
|
||||
}
|
||||
end
|
||||
|
||||
vim.keymap.set("n", "<leader>la", function() rust('codeAction') end, opts("Code action"))
|
||||
vim.keymap.set("n", "<leader>lj", function() rust({ 'renderDiagnostic', "cycle" }) end, opts("Next diagnostic"))
|
||||
vim.keymap.set("n", "<leader>lk", function() rust({ 'renderDiagnostic', "cycle_prev" }) end, opts("Prev diagnostic"))
|
||||
vim.keymap.set("n", "<leader>ld", function() rust({ 'renderDiagnostic', "current" }) end, opts("Current diagnostic"))
|
||||
vim.keymap.set("n", "K", function() rust({ 'hover', 'actions' }) end, opts("Lsp hover"))
|
||||
vim.keymap.set("n", "J", function() rust("joinLines") end, opts("Keep cursor in column while joining lines"))
|
||||
vim.keymap.set("v", "J", function() rust({ "moveItem", "down" }) end, opts("Move line down"))
|
||||
vim.keymap.set("v", "K", function() rust({ "moveItem", "up" }) end, opts("Move line up"))
|
||||
|
||||
|
||||
vim.keymap.set("n", "<leader>lq", function()
|
||||
vim.ui.select({
|
||||
{ label = "Expand macro", cmd = { "expandMacro", } },
|
||||
{ label = "Explain error under cursor", cmd = { "explainError", "current" } },
|
||||
{ label = "Go to related diagnostic", cmd = { "relatedDiagnostics", } },
|
||||
{ label = "Open cargo.toml", cmd = { "openCargo", } },
|
||||
{ label = "Open docs.rs of symbol", cmd = { "openDocs", } },
|
||||
{ label = "Go to parent module", cmd = { "parentModule", } },
|
||||
}, { prompt = "RustLsp: ", format_item = function(item) return item.label end }, function(opt)
|
||||
if opt == nil then return end
|
||||
rust(opt.cmd)
|
||||
end)
|
||||
end, opts("Execute RustLsp action"))
|
||||
Loading…
Add table
Add a link
Reference in a new issue