Neomutt: how to use variables in macros?

Moderator: Forum moderators

Post Reply
moonlanders
Posts: 1
Joined: Tue Jan 30, 2024 10:35 am

Neomutt: how to use variables in macros?

Post by moonlanders »

As a neomutt user, I would want to create scripts and bind them to shortcats. I'm using macros for this, but I find the documentation on how to use variables for macros unexistant.

I will use a really simple example to showcase the user story I try to fulfill (posted in stackoverflow)

In neomutt, I want a macro to execute a command, with the current message ID as argument.

As an example:

macro compose <F12> "<shell-escape>mkdir -p ~/tmp/neomutt/<current_id>/<enter>"

where <current_id> would be the desired variable, passing to the macro command the value of the Message ID of the composed email.

How can this be made?

Is it possible to use a variable for the full macro like:

macro compose <F12> "<shell-escape>mkdir -p ~/tmp/neomutt/<current_id>/<enter>\
<copy-file>~/tmp/<current_id>/message.txt<enter>\
<shell-escape>pandoc -o ~/tmp/<current_id>/message.html ~/tmp/<current_id>/message.txt<enter>\

with custom variables?

I've tried different variables like %i. I'd like also to be able to set variables on runtime like NOW=$(time)

The overall goal is to understand neomutt's macros to use variables like 'current email id' or 'sender' or any data available to pipe them into commands or use the built-in set of functions.

Do you know how to perform this? Do you find complete the neomutt documentation in this topic?

Post Reply

Return to “Business”