diff options
| author | bee <beebeeb5k@gmail.com> | 2026-05-05 22:37:10 +0530 |
|---|---|---|
| committer | bee <beebeeb5k@gmail.com> | 2026-05-05 22:37:10 +0530 |
| commit | 9365a8e96827cbf7bc5adad6d29bcd05b4d761b2 (patch) | |
| tree | 0998a5dcfc4517e4112a2c589e04ac0dbc1e011b /lua/bee/format.lua | |
| parent | 0c50f17133b90c60735f1f51943f51f60372bdd3 (diff) | |
Migrate from nixcats to nix-wrapper-modules
Diffstat (limited to 'lua/bee/format.lua')
| -rw-r--r-- | lua/bee/format.lua | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/lua/bee/format.lua b/lua/bee/format.lua new file mode 100644 index 0000000..c8d1214 --- /dev/null +++ b/lua/bee/format.lua @@ -0,0 +1,35 @@ +return { + "conform.nvim", + auto_enable = true, + event = "FileType", + keys = { + { "<leader>lf", desc = "[F]ormat [F]ile" }, + }, + after = function(_) + local conform = require("conform") + conform.setup({ + format_on_save = { + timeout_ms = 1000, + lsp_format = "fallback", + quiet = true, + }, + formatters_by_ft = { + lua = { "stylua" }, + nix = { "nixfmt" }, + c = { "clang_format" }, + cpp = { "clang_format" }, + cmake = { "cmake_format" }, + -- Use a sub-list to run only the first available formatter + javascript = { { "prettierd", "prettier" } }, + }, + }) + + vim.keymap.set({ "n", "v" }, "<leader>lf", function() + conform.format({ + lsp_fallback = true, + async = false, + timeout_ms = 1000, + }) + end, { desc = "[L]anguage [F]ormat" }) + end, +} |
