diff --git a/lazy-lock.json b/lazy-lock.json index 0eb5f25..5a6543d 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -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" }, diff --git a/lua/plugins/tsdev.lua b/lua/plugins/tsdev.lua index 4e2637e..b772c1b 100644 --- a/lua/plugins/tsdev.lua +++ b/lua/plugins/tsdev.lua @@ -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("", true, false, true), "n", true) + end, { desc = "Conform format" }) end }