2

The header of the attachments menu in neomutt gives the options

q:Exit s:Save |:Pipe p:Print ?:Help

I assumed that the Pipe option would allow me to pipe a chosen attachment to the shell. In particular, maybe I want to open a file in a way that bypasses the mailcap defaults.

Suppose I wanted to open a file from the attachment menu with open. Is there a way to achieve this with Pipe and not by going to edit my mailcap?

Thanks

Jesse
  • 1,662
  • 3
  • 17
  • 18

1 Answers1

1

The only downfall of this is you need to specify all types, because wildcard can be only in subtype - */* or * doesn't work

Store original mailcap file location in a variable

Define macro in attach menu that changes mailcap file to a new one, run view-attach (which uses open to open a file with) and return to original mailcap_path configuration.

~/.muttrc

set my_origmailcap=$mailcap_path

macro attach <Space> "\
<enter-command>set mailcap_path=~/.mailcap2<enter>\
<view-attach>\
<enter-command>set mailcap_path=$my_origmailcap<enter>\
"

~/.mailcap2

audio/* ; open %s
image/* ; open %s
text/*  ; open %s
video/* ; open %s
Jakub Jindra
  • 551
  • 6
  • 12