refactor: restructure init.lua to use lazy plugin manager and add lsp configurations

This commit is contained in:
sankalp committed 2025-09-12 16:05:40 +05:45
1 parent d685e0e553
commit 84f2be62ae
119 files changed
+2201 -18000

No files matched your search

+37
View File
@@ -0,0 +1,37 @@
return {
"stevearc/conform.nvim",
dependencies = { "zapling/mason-conform.nvim" },
event = "BufWritePre",
cmd = "ConformInfo",
keys = { "<leader>tf" },
config = function()
require("conform").setup({
formatters_by_ft = {
lua = { "stylua" },
python = { "black" },
["_"] = { "trim_whitespace" },
},
format_after_save = function(bufnr)
if not vim.b[bufnr].conform_disable then
return {
lsp_format = "fallback",
}
end
end,
})
vim.keymap.set("n", "<leader>tf", function()
vim.b.conform_disable = not vim.b.conform_disable
local status = vim.b.conform_disable and "disabled" or "enabled"
vim.notify("Autoformat " .. status, vim.log.levels.INFO)
end)
require("mason-conform").setup({
ensure_installed = {
"black",
"stylua",
"prettier",
},
automatic_installation = true,
})
end,
}