From 60c287f5e39f81b62d98a25d47f772ef9617ac29 Mon Sep 17 00:00:00 2001 From: Antoine Saez Dumas Date: Thu, 9 Jul 2026 15:25:22 +0200 Subject: [PATCH 1/2] feat: jump to first thread in nm.show_thread --- lua/notmuch/init.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lua/notmuch/init.lua b/lua/notmuch/init.lua index e065206..1899276 100644 --- a/lua/notmuch/init.lua +++ b/lua/notmuch/init.lua @@ -221,8 +221,9 @@ nm.show_thread = function(s) v.nvim_buf_set_lines(buf, 0, 0, false, { hint_text, "" }) -- Place cursor at head of buffer and prepare display and disable modification - v.nvim_buf_set_lines(buf, -2, -1, true, {}) - v.nvim_win_set_cursor(0, { 1, 0}) + v.nvim_buf_set_lines(buf, -2, -1, true, {}) -- remove last line from buffer + v.nvim_win_set_cursor(0, { 4, 0 }) -- jump to first thread + -- set buffer options vim.bo.filetype="mail" vim.bo.modifiable = false From 8356961991a0cbf6739eb19e77a6c626dc5ff819 Mon Sep 17 00:00:00 2001 From: Antoine Saez Dumas Date: Thu, 9 Jul 2026 17:51:28 +0200 Subject: [PATCH 2/2] feat(mail): open first message if there is a single one in the thread --- ftplugin/mail.lua | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ftplugin/mail.lua b/ftplugin/mail.lua index 89d250c..1fa136f 100644 --- a/ftplugin/mail.lua +++ b/ftplugin/mail.lua @@ -4,6 +4,13 @@ if vim.startswith(vim.fs.basename(vim.api.nvim_buf_get_name(0)), "thread:") then vim.opt_local.foldmethod = "marker" vim.opt_local.foldlevel = 0 + -- if there is only one message, open it + if vim.b.notmuch_messages and #vim.b.notmuch_messages == 1 then + vim.schedule(function() + vim.cmd.normal({ args = { "zR" }, bang = true }) + end) + end + vim.api.nvim_buf_create_user_command(0, "TagAdd", function(arg) tag.msg_add_tag(arg.args) end, {