X-Git-Url: https://git.madduck.net/etc/lazyvim.git/blobdiff_plain/5ee63d43d87e25fda83e9187473ffec982945dcc..69c04414be903040ac87497aad646914ab5654fa:/.config/lazyvim/after/ftplugin/mail.lua diff --git a/.config/lazyvim/after/ftplugin/mail.lua b/.config/lazyvim/after/ftplugin/mail.lua index afa4c39..f0b87eb 100644 --- a/.config/lazyvim/after/ftplugin/mail.lua +++ b/.config/lazyvim/after/ftplugin/mail.lua @@ -1,3 +1,18 @@ +local i, _ = string.find(vim.bo.filetype, "markdown") +if not i then + vim.opt_local.filetype = "mail.markdown" + -- this should trigger a reload of the ftplugin + return +end + +-- There are no diagnostics for mail, but we do not want the +-- Markdown standards imposed on mail header and signature… +vim.diagnostic.enable(false) +vim.b.autoformat = false + +-- disable Treesitter format expression for Mail +vim.opt_local.formatexpr = "" + vim.opt_local.formatoptions:remove("o") vim.opt_local.formatoptions:remove("r") vim.opt_local.formatoptions:remove("l") @@ -5,6 +20,23 @@ vim.opt_local.formatoptions:append("a") vim.opt_local.formatoptions:append("w") vim.opt_local.formatoptions:append("n") +vim.keymap.set("n", "m", "", { buffer = true, desc = "mail functions" }) +vim.keymap.set("n", "ms", "", { buffer = true, desc = "subject manipulation" }) + +vim.keymap.set( + "n", + "msn", + ":1,/^$/s,\\v(Subject:)\\s*((Re|AW):\\s*)*((.|\\_s\\s+)+),\\1 (was: \\4),e:set nohlsWhi", + -- set nohlsf li", + { buffer = true, desc = "make a new subject" } +) +vim.keymap.set( + "n", + "msd", + '1G/\\v^Subject:(.|\\_s\\s+)+was:/e:set nohls"_dab', + { buffer = true, desc = "remove old subjects" } +) + vim.keymap.set("n", "p", "", { buffer = true, desc = "mailplate profiles" }) vim.keymap.set(