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 | 21d091f05161af8eb1a61b580c3f57774358aefe (patch) | |
| tree | 430f1a5d0500b8525998a584950fc949a54257cb /plugin/50-format.lua | |
| parent | f517bbdb4efd22d0d0624292b13b2db7eee89793 (diff) | |
| download | nvim-config-21d091f05161af8eb1a61b580c3f57774358aefe.tar.gz nvim-config-21d091f05161af8eb1a61b580c3f57774358aefe.zip | |
refactor(nvim): rename functions and edit comments
Diffstat (limited to 'plugin/50-format.lua')
| -rw-r--r-- | plugin/50-format.lua | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/plugin/50-format.lua b/plugin/50-format.lua index e021227..d77f1fd 100644 --- a/plugin/50-format.lua +++ b/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" }) |
