26 lines
639 B
Lua
26 lines
639 B
Lua
-- Using formatter.nvim: https://github.com/mhartington/formatter.nvim
|
|
return {
|
|
"stevearc/conform.nvim",
|
|
event = { "BufWritePre" },
|
|
cmd = { "ConformInfo" },
|
|
|
|
-- This will provide type hinting with LuaLS
|
|
---@module "conform"
|
|
---@type conform.setupOpts
|
|
opts = {
|
|
formatters_by_ft = {
|
|
lua = { "stylua" },
|
|
python = { "black" },
|
|
javascript = { "prettier" } -- add stop_after_first if you want more than 1
|
|
},
|
|
-- Set default options
|
|
default_format_opts = {
|
|
lsp_format = "fallback"
|
|
},
|
|
format_on_save = { timeout_ms = 500 },
|
|
},
|
|
init = function ()
|
|
vim.o.formatexpr = "v:lua.require'conform'.formatexpr()"
|
|
end
|
|
}
|
|
|