From: martin f. krafft Date: Mon, 19 May 2025 19:24:00 +0000 (+0200) Subject: squash consecutive empty lines in mails X-Git-Url: https://git.madduck.net/etc/lazyvim.git/commitdiff_plain/f0708014115af01e71566bf9d49fe821047c162d?ds=sidebyside;hp=150450bac462b56c175eb075c1915be2b2b81a83 squash consecutive empty lines in mails --- diff --git a/.config/lazyvim/after/ftplugin/mail.lua b/.config/lazyvim/after/ftplugin/mail.lua index 39eaf3e..176382c 100644 --- a/.config/lazyvim/after/ftplugin/mail.lua +++ b/.config/lazyvim/after/ftplugin/mail.lua @@ -23,6 +23,14 @@ vim.opt_local.formatoptions:remove("l") -- would not break lines that were long vim.opt_local.commentstring = "> %s" -- commenting means quoting in mails -- }}} +-- {{{ autocmds +vim.api.nvim_create_autocmd({ "BufWrite" }, { + buffer = 0, + group = vim.api.nvim_create_augroup("squashemptylines", { clear = true }), + command = [[%s/\v(\n)\n+$/\1/ge]], +}) +-- }}} + -- {{{ keymaps vim.keymap.set("n", "m", "", { buffer = true, desc = "mail functions" }) vim.keymap.set("n", "ms", "", { buffer = true, desc = "subject manipulation" })