feat: enhance editor and language support with new plugins and configurations

This commit is contained in:
sankalp committed 2025-09-12 18:26:44 +05:45
1 parent 84f2be62ae
commit 6d3a60c8dd
7 files changed
+315 -151

No files matched your search

+32 -3
View File
@@ -6,11 +6,38 @@ return {
keys = { "<leader>tf" },
config = function()
require("conform").setup({
formatters = {
["markdown-toc"] = {
condition = function(_, ctx)
for _, line in ipairs(vim.api.nvim_buf_get_lines(ctx.buf, 0, -1, false)) do
if line:find("<!%-%-% toc %-%->") then
return true
end
end
end,
},
["markdownlint-cli2"] = {
condition = function(_, ctx)
local diag = vim.tbl_filter(function(d)
return d.source == "markdownlint"
end, vim.diagnostic.get(ctx.buf))
return #diag > 0
end,
},
},
formatters_by_ft = {
lua = { "stylua" },
python = { "black" },
["lua"] = { "stylua" },
["python"] = { "ruff_fix", "ruff_format", "ruff_organize_imports" },
["javascript"] = { "prettier" },
["typescript"] = { "prettier" },
["markdown"] = { "prettier", "markdownlint-cli2", "markdown-toc" },
["markdown.mdx"] = { "prettier", "markdownlint-cli2", "markdown-toc" },
["mdx"] = { "prettier" },
["_"] = { "trim_whitespace" },
},
options = {
stop_after_first = true,
},
format_after_save = function(bufnr)
if not vim.b[bufnr].conform_disable then
return {
@@ -27,9 +54,11 @@ return {
end)
require("mason-conform").setup({
ensure_installed = {
"black",
"ruff",
"stylua",
"prettier",
"markdown-toc",
"markdownlint-cli2",
},
automatic_installation = true,
})