]> git.madduck.net Git - etc/lazyvim.git/commitdiff

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

inject markdown into mail body
authormartin f. krafft <madduck@madduck.net>
Mon, 28 Apr 2025 12:19:34 +0000 (14:19 +0200)
committermartin f. krafft <madduck@madduck.net>
Wed, 6 Aug 2025 09:57:17 +0000 (11:57 +0200)
.config/lazyvim/after/ftplugin/mail.lua
.config/lazyvim/after/queries/mail/injections.scm [new file with mode: 0644]
.config/lazyvim/lua/plugins/markdown-in-mailbody.lua [new file with mode: 0644]
.gitignore.d/lazyvim

index afa4c39bd2b0a2cf3e314c365716316261e19e1a..36c6eade64709b8deff465c03905c2cf7d9c2136 100644 (file)
@@ -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")
diff --git a/.config/lazyvim/after/queries/mail/injections.scm b/.config/lazyvim/after/queries/mail/injections.scm
new file mode 100644 (file)
index 0000000..dd08e00
--- /dev/null
@@ -0,0 +1,2 @@
+((body) @injection.content
+ (#set! injection.language "markdown"))
diff --git a/.config/lazyvim/lua/plugins/markdown-in-mailbody.lua b/.config/lazyvim/lua/plugins/markdown-in-mailbody.lua
new file mode 100644 (file)
index 0000000..1a04d60
--- /dev/null
@@ -0,0 +1,8 @@
+return {
+  {
+    "nvim-treesitter/nvim-treesitter",
+    dependencies = {
+      "stevenxxiu/tree-sitter-mail",
+    },
+  },
+}
index 345a3412d35776665156d0429c797ed7594437ab..86ec3ac3e6b81a44061af73e4047953b3e2b2a0e 100644 (file)
@@ -4,6 +4,7 @@
 !/.config/lazyvim/after/ftplugin/markdown.lua
 !/.config/lazyvim/after/ftplugin/python.lua
 !/.config/lazyvim/after/ftplugin/tex.vim
+!/.config/lazyvim/after/queries/mail/injections.scm
 !/.config/lazyvim/autocmds.lua
 !/.config/lazyvim/ftp
 !/.config/lazyvim/.gitignore
@@ -25,6 +26,7 @@
 !/.config/lazyvim/lua/plugins/disable-tokyonight.lua
 !/.config/lazyvim/lua/plugins/disable-treesitter-indenting.lua
 !/.config/lazyvim/lua/plugins/example.lua
+!/.config/lazyvim/lua/plugins/markdown-in-mailbody.lua
 !/.config/lazyvim/lua/plugins/mini-align.lua
 !/.config/lazyvim/lua/plugins/vim-table-mode.lua
 !/.config/lazyvim/options.lua