diff options
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" }) |
