feat: basic rust nvim setup
chore: Tidy up null-ls stuff that wasn't implemented right
This commit is contained in:
@@ -1,9 +0,0 @@
|
|||||||
|
|
||||||
local null_ls = require("null-ls")
|
|
||||||
local opts = {
|
|
||||||
sources = {
|
|
||||||
null_ls.builtins.diagnostics.mypy,
|
|
||||||
null_ls.builtins.diagnostics.ruff,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
return opts
|
|
@@ -1,25 +0,0 @@
|
|||||||
local null_ls = require("null-ls")
|
|
||||||
local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
|
|
||||||
|
|
||||||
local opts = {
|
|
||||||
sources = {
|
|
||||||
null_ls.builtins.formatting.eslint,
|
|
||||||
null_ls.builtins.formatting.prettier,
|
|
||||||
},
|
|
||||||
on_attach = function(client, bufnr)
|
|
||||||
if client.supports_method("textDocument/formatting") then
|
|
||||||
vim.api.nvim_clear_autocmds({
|
|
||||||
group = augroup,
|
|
||||||
buffer = bufnr,
|
|
||||||
})
|
|
||||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
|
||||||
group = augroup,
|
|
||||||
buffer = bufnr,
|
|
||||||
callback = function()
|
|
||||||
vim.lsp.buf.format({ bufnr = bufnr })
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
return opts
|
|
11
nvim/.config/nvim/lua/custom/configs/rust-tools.lua
Normal file
11
nvim/.config/nvim/lua/custom/configs/rust-tools.lua
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
local on_attach = require("plugins.configs.lspconfig").on_attach
|
||||||
|
local capabilities = require("plugins.configs.lspconfig").capabilities
|
||||||
|
|
||||||
|
local options = {
|
||||||
|
server = {
|
||||||
|
on_attach = on_attach,
|
||||||
|
capabilities = capabilities,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return options
|
@@ -13,6 +13,7 @@ local plugins = {
|
|||||||
"gopls",
|
"gopls",
|
||||||
"goimports",
|
"goimports",
|
||||||
"debugpy",
|
"debugpy",
|
||||||
|
"rust-analyzer",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -26,7 +27,7 @@ local plugins = {
|
|||||||
"jose-elias-alvarez/null-ls.nvim",
|
"jose-elias-alvarez/null-ls.nvim",
|
||||||
ft = "go",
|
ft = "go",
|
||||||
opts = function()
|
opts = function()
|
||||||
return require "custom.configs.null-ls-go"
|
return require "custom.configs.null-ls"
|
||||||
end,
|
end,
|
||||||
}, {
|
}, {
|
||||||
"mfussenegger/nvim-dap",
|
"mfussenegger/nvim-dap",
|
||||||
@@ -55,6 +56,41 @@ local plugins = {
|
|||||||
"NVChad/nvim-autopairs",
|
"NVChad/nvim-autopairs",
|
||||||
enabled = false
|
enabled = false
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"simrat39/rust-tools.nvim",
|
||||||
|
ft = "rust",
|
||||||
|
opts = function ()
|
||||||
|
return require "custom.configs.rust-tools"
|
||||||
|
end,
|
||||||
|
config = function (_, opts)
|
||||||
|
require("rust-tools").setup(opts)
|
||||||
|
end,
|
||||||
|
dependencies = "neovim/nvim-lspconfig"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"rust-lang/rust.vim",
|
||||||
|
ft = "rust",
|
||||||
|
init = function ()
|
||||||
|
vim.g.rustfmt_autosave = 1
|
||||||
|
end
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"saecki/crates.nvim",
|
||||||
|
ft = {"rust", "toml"},
|
||||||
|
config = function(_, opts)
|
||||||
|
local crates = require("crates")
|
||||||
|
crates.setup(opts)
|
||||||
|
crates.show()
|
||||||
|
end
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"hrsh7th/nvim-cmp",
|
||||||
|
opts = function ()
|
||||||
|
local M = require "plugins.configs.cmp"
|
||||||
|
table.insert(M.sources, {name = "crates"})
|
||||||
|
return M
|
||||||
|
end
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"rcarriga/nvim-dap-ui",
|
"rcarriga/nvim-dap-ui",
|
||||||
init = function()
|
init = function()
|
||||||
|
Reference in New Issue
Block a user