Show if a message in the mutt index has an attachment
Asked Answered
B

2

6

Is there a way to have Mutt's index show if a message has an attachment?

This would be similar to how Gmail shows a paperclip next to messages with an attachment.

I can limit the messages with attachments using ~X 1-15, but it's nice to see whether messages have an attachment in the index.

Beghtol answered 6/5, 2016 at 19:54 Comment(0)
K
11

You can add the number of attachments (%X) to the index format setting.

For example, this shows the number of attachments after the status flags:

set index_format="%4C %Z %X %{%y%m%d} %-12.12L %?M?(#%03M)&(%4c)? %?y?(%.20Y) ?%s"

Or, if you only want an indicator, you can use conditionals. If instead of %X you put %?X?A&-?, you'll get A for messages with attachments, and - for messages without.

Search for the chapter Format strings in the supplied documentation.

Karlene answered 6/5, 2016 at 21:39 Comment(3)
This works. You can also use the paperclip unicode symbol 1F4CE to get Gmail look. I use the following string %?X?πŸ“Ž& ?. Either copy paste the symbol or in Vim to enter unicode symbols use CTRL-V Shift-U 1F4CE. – Renovate
Is there a way to do the same for encrypted / signed messages? I imagine something like this: %?S?βœ’οΈ& ? or %?P?πŸ”’& ? but these don't work... – Tommy
Weird thing is, if there is indicator or color for email with attachment, the size part(%?l?%4l&%4c?) in the index goes wrong – Armour
T
3

To put a paper clip for an attachment, the following works for me (and also puts blanks correctly).

set index_format="%Z %?X?πŸ“Ž&  ? %{!%a %b%d'%y %I:%M:%S%p%Z}  %-12.12L  %?M?(#%03M)&(%4c)?  %?y?(%.20Y) ?%s"

I made it a bit more concise to save on screenspace...

Trustworthy answered 24/10, 2020 at 14:33 Comment(0)

© 2022 - 2024 β€” McMap. All rights reserved.