Files
dotfiles/common/.config/nvim/lua/plugins/formatting.lua
Pratik Tripathy 79d80bd7de fix(neovim): LSP, Formatter, Linter all in their places
- Formatter: Don't need both prettier & prettierd. Only use prettierd
- Formatter: markdown-toc is LSP not formatter
- Formatter: shellharden isn't formatter
- Formatter: Only shfmt for shell formatting
- Formatter: Don't need prettier to format yaml
- Linter: codespell on all buffers
- Install script: Remove prettier & shellharden (its useless with bashls)
- LSP: markdownlint, prettier, shellcheck, shellharden, shfmt aren't LSP
2025-09-10 23:58:43 +05:30

55 lines
1.7 KiB
Lua

return {
{
"stevearc/conform.nvim",
lazy = true,
event = { "BufWritePre" },
opts = {
formatters_by_ft = {
sh = { "shfmt" },
bash = { "shfmt" },
zsh = { "shfmt" },
graphql = { "prettierd" },
css = { "prettierd" },
html = { "prettierd" },
javascript = { "prettierd" },
javascriptreact = { "prettierd" },
svelte = { "prettierd" },
typescript = { "prettierd" },
typescriptreact = { "prettierd" },
json = { "prettierd" },
lua = { "stylua" },
markdown = { "markdownlint" },
python = { "black" },
rust = { "rustfmt" },
yaml = { "yamlfmt" },
["_"] = { "trim_whitespace" },
},
format_on_save = {
lsp_fallback = true,
async = false,
timeout_ms = 500,
},
formatters = {
injected = { options = { ignore_errors = true } },
shfmt = { prepend_args = { "-i", "4" } },
markdownlint = {
prepend_args = {
"--config",
vim.loop.os_homedir() .. "/.config/templates/markdownlint.json",
},
},
yamlfmt = {
prepend_args = {
"-formatter",
"include_document_start=true,retain_line_breaks_single=true",
"-gitignore_excludes",
},
},
},
},
},
}