feat(cfg): add prettierd formatting on save
This commit is contained in:
parent
e1eb599844
commit
b5e14de307
3 changed files with 88 additions and 2 deletions
43
lua/custom/plugins/prettier.lua
Normal file
43
lua/custom/plugins/prettier.lua
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
return {
|
||||
'MunifTanjim/prettier.nvim',
|
||||
|
||||
config = function()
|
||||
|
||||
local prettier = require("prettier")
|
||||
|
||||
prettier.setup({
|
||||
bin = 'prettier', -- or `'prettierd'` (v0.23.3+)
|
||||
filetypes = {
|
||||
"css",
|
||||
"graphql",
|
||||
"html",
|
||||
"javascript",
|
||||
"javascriptreact",
|
||||
"json",
|
||||
"less",
|
||||
"markdown",
|
||||
"scss",
|
||||
"typescript",
|
||||
"typescriptreact",
|
||||
"yaml",
|
||||
},
|
||||
})
|
||||
|
||||
prettier.setup({
|
||||
["null-ls"] = {
|
||||
condition = function()
|
||||
return prettier.config_exists({
|
||||
-- if `false`, skips checking `package.json` for `"prettier"` key
|
||||
check_package_json = true,
|
||||
})
|
||||
end,
|
||||
runtime_condition = function(params)
|
||||
-- return false to skip running prettier
|
||||
return true
|
||||
end,
|
||||
timeout = 5000,
|
||||
}
|
||||
})
|
||||
|
||||
end,
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue