+-- {{{ markdown in mail
local i, _ = string.find(vim.bo.filetype, "markdown")
if not i then
vim.opt_local.filetype = "mail.markdown"
-- 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")
+-- {{{ formatting
+vim.opt_local.formatoptions:remove("o") -- would insert current comment leader for o/O
+vim.opt_local.formatoptions:remove("r") -- would insert current comment leader for <CR>
+vim.opt_local.formatoptions:remove("l") -- would not break lines that were long before insert
+vim.opt_local.commentstring = "> %s" -- commenting means quoting in mails
+-- }}}
+
+-- {{{ keymaps
vim.keymap.set("n", "<leader>m", "", { buffer = true, desc = "mail functions" })
vim.keymap.set("n", "<leader>ms", "", { buffer = true, desc = "subject manipulation" })
{ buffer = true, desc = "remove old subjects" }
)
+-- {{{ profiles
+
vim.keymap.set("n", "<leader>p", "", { buffer = true, desc = "mailplate profiles" })
vim.keymap.set(
profile_keymap("F11", "sudetia")
profile_keymap("F12", "default")
+-- }}} profiles
+-- }}}
+
+-- {{{ write mail backups
+
local function write_mail_backup()
local tmpdir = vim.fn.expand(os.getenv("TMPDIR") or "/tmp") .. "/mail-backups"
vim.fn.mkdir(tmpdir, "p", "0o700")
buffer = 0,
})
-vim.cmd.runtime("greeting_abbrevs.vim")
+-- }}}
+
+-- {{{ mail area detect
local function mail_area_detect()
local ts = vim.treesitter
return
end
if node:type():find("^body") ~= nil then
- vim.opt_local.formatoptions:append("a")
- vim.opt_local.formatoptions:append("w")
- vim.opt_local.formatoptions:append("n")
- vim.opt_local.formatoptions:append("t")
- vim.opt_local.formatoptions:append("c")
+ vim.opt_local.formatoptions:append("a") -- turn on auto-reflow
+ vim.opt_local.formatoptions:append("w") -- trailing whitespace for format=flowed
+ vim.opt_local.formatoptions:append("n") -- numbered lists
+ vim.opt_local.formatoptions:append("t") -- autowrap with textwidth
+ vim.opt_local.formatoptions:append("c") -- autowrap and insert quote (comment) leader
vim.w.in_body = true
else
vim.opt_local.formatoptions:remove("a")
callback = mail_area_detect,
})
mail_area_detect()
+
+vim.cmd.runtime("greeting_abbrevs.vim")
+
+-- }}}
+
+-- vim:foldmethod=marker:foldlevel=0