formatting

This commit is contained in:
Christoph J. Scherr 2023-09-15 11:49:26 +02:00 committed by PlexSheep
parent a3744a35cc
commit ca32d0c040
2 changed files with 26 additions and 8 deletions

View File

@ -11,6 +11,7 @@ require('lazy').setup(vim.tbl_extend('keep', config.user_lazy_opts(), {
{ import = 'plex.plugins.extras.coding' },
{ import = 'plex.plugins.extras.ui' },
{ import = 'plex.plugins.extras.treesitter' },
{ import = 'plex.plugins.extras.formatting' },
{ import = 'plex.plugins.extras.editor' },
{ import = 'plex.plugins.extras.org' },
{ import = 'plex.plugins.extras.lang.go' },

View File

@ -4,32 +4,49 @@
return {
{
'williamboman/mason.nvim',
"williamboman/mason.nvim",
opts = function(_, opts)
if type(opts.ensure_installed) == 'table' then
table.insert(opts.ensure_installed, 'prettierd')
if type(opts.ensure_installed) == "table" then
table.insert(opts.ensure_installed, "prettierd")
end
end,
},
{
'mhartington/formatter.nvim',
"mhartington/formatter.nvim",
optional = true,
keys = {
{ "<Leader>ff", "<cmd>Format<CR>", desc = "Use Formatter" },
},
opts = function(_, opts)
opts = opts or {}
local filetypes = {
-- FIXME:add more filetypes
json = { require('formatter.defaults.prettierd') },
json = { require("formatter.defaults.prettierd") },
rust = {
rustfmt = function()
return {
exe = "rustfmt",
args = { "--emit=std ut" },
stdin = true,
}
end,
},
["*"] = {
-- "formatter.filetypes.any" defines default configurations for any
-- filetype
require("formatter.filetypes.any").remove_trailing_whitespace,
},
}
opts.filetype = vim.tbl_extend('keep', opts.filetype or {}, filetypes)
opts.filetype = vim.tbl_extend("keep", opts.filetype or {}, filetypes)
end,
},
{
'jose-elias-alvarez/null-ls.nvim',
"jose-elias-alvarez/null-ls.nvim",
optional = true,
opts = function(_, opts)
local nls = require('null-ls')
local nls = require("null-ls")
table.insert(opts.sources, nls.builtins.formatting.prettierd)
end,
},