From f0708014115af01e71566bf9d49fe821047c162d Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Mon, 19 May 2025 21:24:00 +0200 Subject: [PATCH] squash consecutive empty lines in mails --- .config/lazyvim/after/ftplugin/mail.lua | 8 ++++++++ 1 file changed, 8 insertions(+) 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" }) -- 2.39.5