58 lines
1.2 KiB
Lua
58 lines
1.2 KiB
Lua
|
local u = require "utils"
|
||
|
|
||
|
-- Config Formatter
|
||
|
u.create_augroup(
|
||
|
{
|
||
|
{"BufWritePost", "*.js,*.jsx,*.ts,*.tsx,*.rs,*.lua", "FormatWrite"}
|
||
|
},
|
||
|
"FormatAutogroup"
|
||
|
)
|
||
|
|
||
|
require("formatter").setup(
|
||
|
{
|
||
|
logging = false,
|
||
|
filetype = {
|
||
|
typescript = {
|
||
|
-- prettier
|
||
|
function()
|
||
|
return {
|
||
|
exe = "prettier",
|
||
|
args = {"--stdin-filepath", vim.api.nvim_buf_get_name(0), "--single-quote"},
|
||
|
stdin = true
|
||
|
}
|
||
|
end
|
||
|
},
|
||
|
javascript = {
|
||
|
-- prettier
|
||
|
function()
|
||
|
return {
|
||
|
exe = "prettier",
|
||
|
args = {"--stdin-filepath", vim.api.nvim_buf_get_name(0), "--single-quote"},
|
||
|
stdin = true
|
||
|
}
|
||
|
end
|
||
|
},
|
||
|
svelte = {
|
||
|
-- prettier
|
||
|
function()
|
||
|
return {
|
||
|
exe = "prettier",
|
||
|
args = {"--stdin-filepath", vim.api.nvim_buf_get_name(0), "--single-quote"},
|
||
|
stdin = true
|
||
|
}
|
||
|
end
|
||
|
},
|
||
|
lua = {
|
||
|
-- luafmt
|
||
|
function()
|
||
|
return {
|
||
|
exe = "luafmt",
|
||
|
args = {"--indent-count", 2, "--stdin"},
|
||
|
stdin = true
|
||
|
}
|
||
|
end
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
)
|