feat: add rustaceanvim
This commit is contained in:
parent
03409a59f0
commit
1c041405c9
4 changed files with 32 additions and 8 deletions
14
init.lua
14
init.lua
|
|
@ -6,15 +6,15 @@ vim.lsp.enable({ "lua_ls", "nixd" })
|
||||||
vim.api.nvim_create_autocmd("LspAttach", {
|
vim.api.nvim_create_autocmd("LspAttach", {
|
||||||
callback = function(ev)
|
callback = function(ev)
|
||||||
local opts = { buffer = ev.buf }
|
local opts = { buffer = ev.buf }
|
||||||
vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts)
|
vim.keymap.set("n", "K", vim.lsp.buf.hover, opts)
|
||||||
vim.keymap.set("n", "K", vim.lsp.buf.hover, opts)
|
vim.keymap.set("n", "<leader>gd", vim.lsp.buf.definition, opts)
|
||||||
vim.keymap.set("n", "grn", vim.lsp.buf.rename, opts)
|
vim.keymap.set("n", "<leader>gr", vim.lsp.buf.references, opts)
|
||||||
vim.keymap.set("n", "gra", vim.lsp.buf.code_action, opts)
|
vim.keymap.set("n", "<leader>r", vim.lsp.buf.rename, opts)
|
||||||
vim.keymap.set("n", "grr", vim.lsp.buf.references, opts)
|
vim.keymap.set("n", "<leader>a", vim.lsp.buf.code_action, opts)
|
||||||
vim.keymap.set("n", "<leader>f", function()
|
vim.keymap.set("n", "<leader>ff", function()
|
||||||
vim.lsp.buf.format({ async = true })
|
vim.lsp.buf.format({ async = true })
|
||||||
end, opts)
|
end, opts)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
vim.cmd.colorschem("gruvbox")
|
vim.cmd.colorscheme("gruvbox")
|
||||||
|
|
|
||||||
|
|
@ -3,5 +3,6 @@
|
||||||
"friendly-snippets": { "branch": "main", "commit": "6cd7280adead7f586db6fccbd15d2cac7e2188b9" },
|
"friendly-snippets": { "branch": "main", "commit": "6cd7280adead7f586db6fccbd15d2cac7e2188b9" },
|
||||||
"gruvbox.nvim": { "branch": "main", "commit": "561126520034a1dac2f78ab063db025d12555998" },
|
"gruvbox.nvim": { "branch": "main", "commit": "561126520034a1dac2f78ab063db025d12555998" },
|
||||||
"lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" },
|
"lazy.nvim": { "branch": "main", "commit": "306a05526ada86a7b30af95c5cc81ffba93fef97" },
|
||||||
"nvim-treesitter": { "branch": "main", "commit": "dc42c209f3820bdfaae0956f15de29689aa6b451" }
|
"nvim-treesitter": { "branch": "main", "commit": "dc42c209f3820bdfaae0956f15de29689aa6b451" },
|
||||||
|
"rustaceanvim": { "branch": "master", "commit": "13f7f5c46d2db0b8daee64a842d8faebfe9064c0" }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
5
lua/plugins/rustaceanvim.lua
Normal file
5
lua/plugins/rustaceanvim.lua
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
return {
|
||||||
|
'mrcjkb/rustaceanvim',
|
||||||
|
version = '^8',
|
||||||
|
lazy = false,
|
||||||
|
}
|
||||||
18
rust.lua
Normal file
18
rust.lua
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
local bufnr = vim.api.nvim_get_current_buf()
|
||||||
|
vim.keymap.set(
|
||||||
|
'n',
|
||||||
|
'<leader>a',
|
||||||
|
function()
|
||||||
|
vim.cmd.RustLsp('codeAction')
|
||||||
|
end,
|
||||||
|
{ silent = true, buffer = bufnr }
|
||||||
|
)
|
||||||
|
|
||||||
|
vim.keymap.set(
|
||||||
|
'n',
|
||||||
|
'K',
|
||||||
|
function()
|
||||||
|
vim.cmd.RustLsp({ 'hover', 'actions' })
|
||||||
|
end,
|
||||||
|
{ silent = true, buffer = bufnr }
|
||||||
|
)
|
||||||
Loading…
Add table
Add a link
Reference in a new issue