replace == with conform

This commit is contained in:
hyper 2024-10-06 16:25:01 +08:00
parent 98c76f67f2
commit e31646dcf0
2 changed files with 12 additions and 1 deletions

View File

@ -4,6 +4,7 @@
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
"cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"conform.nvim": { "branch": "master", "commit": "40d4e98fcc3e6f485f0e8924c63734bc7e305967" },
"flash.nvim": { "branch": "main", "commit": "34c7be146a91fec3555c33fe89c7d643f6ef5cf1" },
"grug-far.nvim": { "branch": "main", "commit": "b7c2b28e49d55ff71cd9bb3ad19a2021316510d8" },
"gruvbox.nvim": { "branch": "main", "commit": "49d9c0b150ba70efcd831ec7b3cb8ee740067045" },

View File

@ -51,7 +51,8 @@ return {
'stevearc/conform.nvim',
opts = {},
config = function()
require("conform").setup({
local conform = require('conform')
conform.setup({
formatters_by_ft = {
-- lua = { "stylua" },
-- Conform will run multiple formatters sequentially
@ -66,6 +67,15 @@ return {
html = { "prettierd" },
},
})
vim.keymap.set("n", "==", function()
conform.format({async = true, lsp_format = "fallback"})
end, { desc = "Conform format" })
vim.keymap.set("v", "=", function()
conform.format({async = true, lsp_format = "fallback"})
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("<Esc>", true, false, true), "n", true)
end, { desc = "Conform format" })
end
}