My Neovim Plugins #4 — conform.nvim
I love prettier, therefore, I need a plugin which runs prettier on file save for me. For this job, I'm using conform.nvim. This runs formatter like prettier, prettierd or stylua on my files.
Config
return {
"stevearc/conform.nvim",
event = { "BufReadPre", "BufNewFile" },
config = function()
local conform = require("conform")
conform.setup({
formatters_by_ft = {
javascript = { "prettier" },
typescript = { "prettier" },
javascriptreact = { "prettier" },
typescriptreact = { "prettier" },
css = { "prettier" },
html = { "prettier" },
json = { "prettier" },
yaml = { "prettier" },
markdown = { "prettier" },
graphql = { "prettier" },
pug = { "prettier" },
lua = { "stylua" },
},
format_on_save = {
lsp_format = "fallback",
async = false,
},
})
end,
}
Before, I was using null-ls, which is not maintained anymore. And with conform.nvim I've found a good replacement. :)
72 of #100DaysToOffload
Thoughts? Discuss...