aboutsummaryrefslogtreecommitdiffstats
path: root/modules/communication/neomutt/macros.nix
blob: 57444d9a3ae92dc4e41139d8e0fcb3343063f297 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# neomutt macros for sync, URL extraction, flag legend, and quit
{ config, lib, ... }:
{
  config.programs.neomutt.macros = lib.mkIf config.communication.neomutt.enable [
    {
      # Sync the mailbox and run the external sync script
      map = [
        "index"
        "pager"
      ];
      key = "gs";
      action = "<enter-command>set my_wait_key=$wait_key wait_key=no<enter><sync-mailbox><shell-escape>${lib.getExe config.scripts.neomutt-sync.package}<enter><sync-mailbox><enter-command>set wait_key=$my_wait_key<enter>";
    }
    {
      # Extract every URL from the message via urlscan into a picker menu
      map = [
        "index"
        "pager"
      ];
      key = "gx";
      action = "<pipe-message>urlscan<enter>";
    }
    {
      # Pipe the selected attachment instead of the whole message
      map = [ "attach" ];
      key = "gx";
      action = "<pipe-entry>${lib.getExe config.web.chawan.package} -o \"title='neomutt'\" <enter>";
    }
    {
      # Clear the current limit and show every message again
      map = [ "index" ];
      key = "gF";
      action = "<limit>all<enter>";
    }
    {
      # Save the mailbox and quit
      map = [ "index" ];
      key = "ZZ";
      action = "<sync-mailbox><quit>";
    }
  ];
}