Skip to content

Plugin to overlay email Message-IDs with the email subject. Requires notmuch.

License

Notifications You must be signed in to change notification settings

choener/notmuch.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A simple notmuch plugin for neovim

  • This plugin overlays "Message-ID" strings from emails in your text with the "date", "subject", and "from" information from your emails.
  • In addition, this information is used to run notmuch searches and display the results in neomutt.
  • This makes it possible to annotate notes with email information and jump into email threads right from your notes.

Requirements

Howto use

  • Place a string starting with Message-ID: <prefix@suffix> in your text

  • Whenever not in insert mode, the line starting with Message-ID: ... until the end of the line will have an overlay with the string: YYYY-MM-DD HH:MM Subject From| To...To

  • If the Message-ID is unknown, there will be no overlay

  • lua require('notmuch').openNeomutt jumps to the email chain starting with the Message-ID

  • lua require('notmuch').pickMail open a telescope picker with all starting emails based on Message-ID

Example:

Message-ID: <prefix@suffix> becomes
2024-02-29 22:00 Initial Release [email protected]| [email protected]

Configuration

Configure searches and colors for the overlays:

local nme = require'notmuch'
nme.setup({
  keys = {
    { 'NOTMUCH', },
    { 'Message%-ID:', { search = '%s*%<([^%>]+)%>',
                       query = 'id:\'%s\'',
                       notmuch = 'id:\'%s\'',
                     },
    },
  },
})

vim.api.nvim_set_hl(nme.ns, 'EmailDate'   , { fg = '#ffffff', bg = '#000099' })
vim.api.nvim_set_hl(nme.ns, 'EmailSubject', { fg = '#ffffff', bg = '#000077' })
vim.api.nvim_set_hl(nme.ns, 'EmailAuthors', { fg = '#ffffff', bg = '#000099' })
vim.api.nvim_set_hl_ns(nme.ns)

Configure shortcuts for direct jumps to neomutt or the mail picker (here in an after plugin):

local wk = require('which-key')
local ne = require('notmuch')
ne.replaceMessageId()
wk.register({
  ['<leader>'] = {
    t = { name = '+neorg',
      e = { ne.openNeomutt, 'open neomutt with Message-ID query' },
      E = { ne.pickMail, 'Open picker for all Mails' },
    },
  },
}, { noremap = true, silent = true, })

Devoloper notes

About

Plugin to overlay email Message-IDs with the email subject. Requires notmuch.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages