formatting/linting added for lua/ts
This commit is contained in:
parent
e54f6ee975
commit
61d3aec608
18 changed files with 338 additions and 710 deletions
30
lua/plugins/formatter.lua
Normal file
30
lua/plugins/formatter.lua
Normal file
|
@ -0,0 +1,30 @@
|
|||
return {
|
||||
"stevearc/conform.nvim",
|
||||
opts = {
|
||||
-- https://github.com/stevearc/conform.nvim?tab=readme-ov-file#setup
|
||||
notify_on_error = true,
|
||||
formatters_by_ft = {
|
||||
lua = { "stylua" },
|
||||
typescript = { { "prettierd", "prettier" } },
|
||||
typescriptreact = { { "prettierd", "prettier" } },
|
||||
javascript = { { "prettierd", "prettier" } },
|
||||
javascriptreact = { { "prettierd", "prettier" } },
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
{
|
||||
"<leader>l<leader>",
|
||||
function()
|
||||
require("conform").format({ async = true, lsp_fallback = true }, function(err, edited)
|
||||
if edited then
|
||||
print("Formatted!")
|
||||
else
|
||||
print("Nothing to format!")
|
||||
end
|
||||
end)
|
||||
end,
|
||||
mode = { "n", "v", "x" },
|
||||
desc = "Format buffer",
|
||||
},
|
||||
},
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue