61 lines
1.3 KiB
Lua
61 lines
1.3 KiB
Lua
return {
|
|
-- Buffer format on save
|
|
{
|
|
"stevearc/conform.nvim",
|
|
config = function()
|
|
require("conform").setup({
|
|
formatters_by_ft = {
|
|
lua = { "stylua" },
|
|
python = { "isort", "black" },
|
|
rust = { "rustfmt", lsp_format = "fallback" },
|
|
javascript = { "prettierd", "prettier", stop_after_first = true },
|
|
cpp = { "clang-format" },
|
|
},
|
|
format_on_save = {
|
|
-- These options will be passed to conform.format()
|
|
timeout_ms = 500,
|
|
lsp_format = "fallback",
|
|
},
|
|
})
|
|
end,
|
|
},
|
|
-- Automatic LSP setup
|
|
{
|
|
"williamboman/mason-lspconfig.nvim",
|
|
tag = "v1.32.0",
|
|
dependencies = { "williamboman/mason.nvim", "neovim/nvim-lspconfig" },
|
|
lazy = false,
|
|
keys = {
|
|
{
|
|
"ca",
|
|
vim.lsp.buf.code_action,
|
|
desc = "LSP: [C]ode Action",
|
|
},
|
|
{
|
|
"<leader>rr",
|
|
vim.lsp.buf.rename,
|
|
desc = "LSP rename",
|
|
},
|
|
{
|
|
"<leader>lh",
|
|
vim.lsp.buf.hover,
|
|
desc = "[L]sp: Hover",
|
|
},
|
|
},
|
|
|
|
config = function()
|
|
require("mason").setup({})
|
|
|
|
require("mason-lspconfig").setup({
|
|
automatic_installation = true,
|
|
ensure_installed = { "lua_ls", "rust_analyzer", "clangd", "cmake" },
|
|
})
|
|
|
|
require("mason-lspconfig").setup_handlers({
|
|
function(server_name)
|
|
require("lspconfig")[server_name].setup({})
|
|
end,
|
|
})
|
|
end,
|
|
},
|
|
}
|