Nvim: change neoformat to conform and update plugins
This commit is contained in:
parent
7c1ded08bd
commit
861ca9ebaa
4 changed files with 72 additions and 59 deletions
29
home/.config/nvim/lua/plugins/conform.lua
Normal file
29
home/.config/nvim/lua/plugins/conform.lua
Normal file
|
@ -0,0 +1,29 @@
|
|||
local prettier = { "prettierd", "prettier", stop_after_first = true }
|
||||
|
||||
-- Formatter plugin
|
||||
--- @type LazyPluginSpec
|
||||
return {
|
||||
"stevearc/conform.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = {
|
||||
formatters_by_ft = {
|
||||
lua = { "stylua" },
|
||||
javascript = prettier,
|
||||
json = prettier,
|
||||
python = { "black" },
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
{
|
||||
desc = "Format with Conform",
|
||||
"<leader>f",
|
||||
function()
|
||||
require("conform").format()
|
||||
end,
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
require("conform").setup(opts)
|
||||
vim.o.formatexpr = "v:lua.require'conform'.formatexpr()"
|
||||
end,
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue