init
This commit is contained in:
46
nvim/lua/plugins/extras/formatting/prettier-extended.lua
Normal file
46
nvim/lua/plugins/extras/formatting/prettier-extended.lua
Normal file
@@ -0,0 +1,46 @@
|
||||
local prettier = { "prettierd", "prettier", stop_after_first = true }
|
||||
|
||||
return {
|
||||
{ import = "lazyvim.plugins.extras.formatting.prettier" },
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
"prettierd",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"stevearc/conform.nvim",
|
||||
optional = true,
|
||||
opts = {
|
||||
formatters_by_ft = {
|
||||
["javascript"] = prettier,
|
||||
["javascriptreact"] = prettier,
|
||||
["typescript"] = prettier,
|
||||
["typescriptreact"] = prettier,
|
||||
["vue"] = prettier,
|
||||
["css"] = prettier,
|
||||
["scss"] = prettier,
|
||||
["less"] = prettier,
|
||||
["html"] = prettier,
|
||||
["json"] = prettier,
|
||||
["jsonc"] = prettier,
|
||||
["yaml"] = prettier,
|
||||
["markdown"] = prettier,
|
||||
["markdown.mdx"] = prettier,
|
||||
["graphql"] = prettier,
|
||||
["handlebars"] = prettier,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"luckasRanarison/nvim-devdocs",
|
||||
optional = true,
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
"prettier",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
19
nvim/lua/plugins/extras/formatting/ruff.lua
Normal file
19
nvim/lua/plugins/extras/formatting/ruff.lua
Normal file
@@ -0,0 +1,19 @@
|
||||
return {
|
||||
{
|
||||
"stevearc/conform.nvim",
|
||||
opts = function(_, opts)
|
||||
opts.formatters_by_ft.python = opts.formatters_by_ft.python or {}
|
||||
table.insert(opts.formatters_by_ft.python, "ruff_format")
|
||||
table.insert(opts.formatters_by_ft.python, "ruff_fix")
|
||||
return opts
|
||||
end,
|
||||
},
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
"ruff",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
33
nvim/lua/plugins/extras/formatting/rustywind.lua
Normal file
33
nvim/lua/plugins/extras/formatting/rustywind.lua
Normal file
@@ -0,0 +1,33 @@
|
||||
return {
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
"rustywind",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"stevearc/conform.nvim",
|
||||
opts = function(_, opts)
|
||||
local function add_formatters(tbl)
|
||||
for ft, formatters in pairs(tbl) do
|
||||
if opts.formatters_by_ft[ft] == nil then
|
||||
opts.formatters_by_ft[ft] = formatters
|
||||
else
|
||||
vim.list_extend(opts.formatters_by_ft[ft], formatters)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
add_formatters({
|
||||
["javascript"] = { "rustywind" },
|
||||
["javascriptreact"] = { "rustywind" },
|
||||
["typescript"] = { "rustywind" },
|
||||
["typescriptreact"] = { "rustywind" },
|
||||
["vue"] = { "rustywind" },
|
||||
["html"] = { "rustywind" },
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
30
nvim/lua/plugins/extras/formatting/shfmt.lua
Normal file
30
nvim/lua/plugins/extras/formatting/shfmt.lua
Normal file
@@ -0,0 +1,30 @@
|
||||
return {
|
||||
{
|
||||
"stevearc/conform.nvim",
|
||||
opts = function(_, opts)
|
||||
local function add_formatters(tbl)
|
||||
for ft, formatters in pairs(tbl) do
|
||||
if opts.formatters_by_ft[ft] == nil then
|
||||
opts.formatters_by_ft[ft] = formatters
|
||||
else
|
||||
vim.list_extend(opts.formatters_by_ft[ft], formatters)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
add_formatters({
|
||||
["sh"] = { "shfmt" },
|
||||
["bash"] = { "shfmt" },
|
||||
["zsh"] = { "shfmt" },
|
||||
})
|
||||
end,
|
||||
},
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
"shfmt",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
8
nvim/lua/plugins/extras/formatting/trim_newlines.lua
Normal file
8
nvim/lua/plugins/extras/formatting/trim_newlines.lua
Normal file
@@ -0,0 +1,8 @@
|
||||
return {
|
||||
"stevearc/conform.nvim",
|
||||
opts = function(_, opts)
|
||||
opts.formatters_by_ft["_"] = opts.formatters_by_ft["_"] or {}
|
||||
table.insert(opts.formatters_by_ft["_"], "trim_newlines")
|
||||
return opts
|
||||
end,
|
||||
}
|
||||
8
nvim/lua/plugins/extras/formatting/trim_whitespace.lua
Normal file
8
nvim/lua/plugins/extras/formatting/trim_whitespace.lua
Normal file
@@ -0,0 +1,8 @@
|
||||
return {
|
||||
"stevearc/conform.nvim",
|
||||
opts = function(_, opts)
|
||||
opts.formatters_by_ft["_"] = opts.formatters_by_ft["_"] or {}
|
||||
table.insert(opts.formatters_by_ft["_"], "trim_whitespace")
|
||||
return opts
|
||||
end,
|
||||
}
|
||||
Reference in New Issue
Block a user