2

I know mutt allows me to define custom keyboard macros. But is it possible to define custom functions - unbound macros so to speak - that can be executed via mutt's command line. Like so ":custom_command"

Hope someone can help.

2 Answers2

1

You can't create custom commands in mutt/neomutt.

But there's a patch for mutt called unbind by David Champion (dgc). I don't remember if it supports unmacro also). Neomutt has native support for unbind and unmacro commands heavily inspired by dgc's patch.

To Change macros and bindins I would create different config files which would be bound to some keys. Let's say F11 and F12. And let them source those config files.

F11 would unbind and unmacro every key F12 has binds and macros bound to. And opposite.

0

It's not quite everything you wanted, but...

You could source a file. The file could be assigned to a variable. Beware of spaces.

:source $my_custom_command
:source "$my_executable ARGS"|

Note: source EXECUTABLE| causes the stdout of the EXECUTABLE (or any other command interpretable by sh) to be parsed by neomutt just like an rc configuration file.

If you are aware of your current directory, you can directly type filenames.

:source FILE_NAME
:source ./FILE_NAME|
:source "./FILE_NAME ARGS"|

Note: Be sure to chmod +x FILE_NAME if you use ./FILE_NAME|

You can do anything.

Paul
  • 124