diff options
| author | Thomas Vanbesien <tvanbesi@proton.me> | 2026-06-13 11:17:32 +0200 |
|---|---|---|
| committer | Thomas Vanbesien <tvanbesi@proton.me> | 2026-06-13 11:17:32 +0200 |
| commit | 48b8993dacd948ce3f1426c35039c3ec38ae21e3 (patch) | |
| tree | 5d33b41609e9c930ccf67a039418a3e54c68427e /.config/nvim/plugin/50-format.lua | |
| parent | 828790b2f206691d252abfc007564284c9b75806 (diff) | |
| download | dotfiles-48b8993dacd948ce3f1426c35039c3ec38ae21e3.tar.gz dotfiles-48b8993dacd948ce3f1426c35039c3ec38ae21e3.zip | |
refactor(nvim): rename functions and edit comments
Diffstat (limited to '.config/nvim/plugin/50-format.lua')
| -rw-r--r-- | .config/nvim/plugin/50-format.lua | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/.config/nvim/plugin/50-format.lua b/.config/nvim/plugin/50-format.lua index e021227..d77f1fd 100644 --- a/.config/nvim/plugin/50-format.lua +++ b/.config/nvim/plugin/50-format.lua @@ -39,7 +39,7 @@ formatters.bash = formatters.sh --- Format the buffer `ev.buf` with the formatter for its filetype. --- This function is meant to be an event handler for `vim.api.nvim_create_autocmd()` --- @param ev table `ev` argument passed from `vim.api.nvim_create_autocmd()` -local function on_format(ev) +local function format_buffer(ev) if vim.b[ev.buf].format ~= true then return end @@ -59,10 +59,12 @@ local function on_format(ev) vim.fn.winrestview(view) end +---------------------------------------------------------------------------------------------------- + vim.api.nvim_create_autocmd("BufWritePre", { desc = "Format buffer", group = vim.g.dotfiles.augroup, - callback = on_format, + callback = format_buffer, }) vim.api.nvim_create_user_command("FormatToggle", toggle_format, { desc = "Toggle format on save" }) |
