diff options
| author | Thomas Vanbesien <tvanbesi@proton.me> | 2026-06-11 19:53:59 +0200 |
|---|---|---|
| committer | Thomas Vanbesien <tvanbesi@proton.me> | 2026-06-11 20:08:37 +0200 |
| commit | b62430bb2610198bffb076a59755ad74b4a3d50a (patch) | |
| tree | 1fd55be01a1e31b35440b56bb5c6176dc59c0eb4 /.config/nvim/plugin/50-autoformat.lua | |
| parent | 796b523aa141dd6aff2d100ddcc46f2895859ecd (diff) | |
| download | dotfiles-b62430bb2610198bffb076a59755ad74b4a3d50a.tar.gz dotfiles-b62430bb2610198bffb076a59755ad74b4a3d50a.zip | |
refactor(nvim): rewrite the buffer formatting flow
Diffstat (limited to '.config/nvim/plugin/50-autoformat.lua')
| -rw-r--r-- | .config/nvim/plugin/50-autoformat.lua | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/.config/nvim/plugin/50-autoformat.lua b/.config/nvim/plugin/50-autoformat.lua deleted file mode 100644 index 4761097..0000000 --- a/.config/nvim/plugin/50-autoformat.lua +++ /dev/null @@ -1,24 +0,0 @@ --- --- Autoformat plugin --- - -local function toggle_autoformat() - vim.b.autoformat = not vim.b.autoformat -end - --- Autoformat -vim.api.nvim_create_autocmd("BufWritePre", { - desc = "Autoformat buffer", - group = vim.g.dotfiles.augroup, - callback = function(ev) - if vim.b.autoformat then - if vim.b.format_func == nil then - vim.notify("No formatter set for " .. ev.file .. " (" .. vim.o.filetype .. ")", vim.log.levels.WARN) - return - end - vim.b.format_func() - end - end, -}) - -vim.api.nvim_create_user_command("AutoformatToggle", toggle_autoformat, { desc = "Toggle autoformatting" }) |
