2023-02-18 16:16:01 -03:00
|
|
|
{ pkgs, lib, config, ... }:
|
2023-02-16 12:07:46 -03:00
|
|
|
let
|
|
|
|
inherit (pkgs.uservars) key;
|
|
|
|
inherit (lib) toUpper;
|
2023-02-18 16:16:01 -03:00
|
|
|
|
|
|
|
mkControlBind = key: ''"^${ key }"'';
|
|
|
|
mkAltBind = key: ''"\e${ key }"'';
|
|
|
|
|
|
|
|
mkDirectionBinds' = filter: modes: commands: map
|
|
|
|
(direction: lib.mkIf (lib.hasAttr direction commands) {
|
|
|
|
map = modes;
|
|
|
|
key = filter key.${direction};
|
|
|
|
action = commands.${direction};
|
|
|
|
}) [ "left" "down" "up" "right" ];
|
|
|
|
|
|
|
|
mkDirectionBinds = mkDirectionBinds' (x: x);
|
|
|
|
mkDirectionBindsControl = mkDirectionBinds' mkControlBind;
|
|
|
|
|
2023-02-16 12:07:46 -03:00
|
|
|
in
|
|
|
|
{
|
|
|
|
programs.neomutt.enable = true;
|
2023-02-18 16:16:01 -03:00
|
|
|
programs.neomutt.sidebar.enable = false;
|
|
|
|
programs.neomutt.sort = "reverse-date";
|
|
|
|
programs.neomutt.binds =
|
|
|
|
(mkDirectionBindsControl [ "index" "pager" ] {
|
|
|
|
up = "half-up";
|
|
|
|
down = "half-down";
|
|
|
|
}) ++
|
|
|
|
(mkDirectionBindsControl [ "index" "pager" ] {
|
|
|
|
left = "sidebar-toggle-visible";
|
|
|
|
down = "sidebar-next";
|
|
|
|
up = "sidebar-prev";
|
|
|
|
right = "sidebar-open";
|
|
|
|
}) ++
|
|
|
|
(mkDirectionBinds [ "index" ] {
|
|
|
|
left = "noop";
|
|
|
|
down = "next-entry";
|
|
|
|
up = "previous-entry";
|
|
|
|
right = "display-message";
|
|
|
|
}) ++
|
|
|
|
(mkDirectionBinds [ "pager" ] {
|
|
|
|
left = "exit";
|
|
|
|
down = "next-line";
|
|
|
|
up = "previous-line";
|
|
|
|
right = "view-attachments";
|
|
|
|
}) ++
|
|
|
|
(mkDirectionBinds [ "attach" ] {
|
|
|
|
left = "exit";
|
|
|
|
down = "next-entry";
|
|
|
|
up = "previous-entry";
|
|
|
|
right = "view-mailcap";
|
|
|
|
}) ++ [
|
|
|
|
# {
|
|
|
|
# map = [ "index" ];
|
|
|
|
# key = key.left;
|
|
|
|
# action = "noop";
|
|
|
|
# }
|
|
|
|
# {
|
|
|
|
# map = [ "index" ];
|
|
|
|
# key = key.down;
|
|
|
|
# action = "next-entry";
|
|
|
|
# }
|
|
|
|
# {
|
|
|
|
# map = [ "index" ];
|
|
|
|
# key = key.up;
|
|
|
|
# action = "previous-entry";
|
|
|
|
# }
|
|
|
|
# {
|
|
|
|
# map = [ "index" ];
|
|
|
|
# key = key.right;
|
|
|
|
# action = "display-message";
|
|
|
|
# }
|
|
|
|
|
|
|
|
# {
|
|
|
|
# map = [ "attach" ];
|
|
|
|
# key = key.left;
|
|
|
|
# action = "exit";
|
|
|
|
# }
|
|
|
|
# {
|
|
|
|
# map = [ "attach" ];
|
|
|
|
# key = key.down;
|
|
|
|
# action = "next-entry";
|
|
|
|
# }
|
|
|
|
# {
|
|
|
|
# map = [ "attach" ];
|
|
|
|
# key = key.up;
|
|
|
|
# action = "previous-entry";
|
|
|
|
# }
|
|
|
|
# {
|
|
|
|
# map = [ "attach" ];
|
|
|
|
# key = key.right;
|
|
|
|
# action = "view-mailcap";
|
|
|
|
# }
|
|
|
|
|
|
|
|
# {
|
|
|
|
# map = [ "pager" ];
|
|
|
|
# key = key.left;
|
|
|
|
# action = "exit";
|
|
|
|
# }
|
|
|
|
# {
|
|
|
|
# map = [ "pager" ];
|
|
|
|
# key = key.down;
|
|
|
|
# action = "next-line";
|
|
|
|
# }
|
|
|
|
# {
|
|
|
|
# map = [ "pager" ];
|
|
|
|
# key = key.up;
|
|
|
|
# action = "previous-line";
|
|
|
|
# }
|
|
|
|
# {
|
|
|
|
# map = [ "pager" ];
|
|
|
|
# key = key.right;
|
|
|
|
# action = "view-attachments";
|
|
|
|
# }
|
|
|
|
|
|
|
|
# {
|
|
|
|
# map = [ "index" "pager" "browser" ];
|
|
|
|
# key = toUpper key.up;
|
|
|
|
# action = "half-up";
|
|
|
|
# }
|
|
|
|
# {
|
|
|
|
# map = [ "index" "pager" "browser" ];
|
|
|
|
# key = toUpper key.down;
|
|
|
|
# action = "half-down";
|
|
|
|
# }
|
|
|
|
|
|
|
|
{
|
|
|
|
map = [ "browser" ];
|
|
|
|
key = key.left;
|
|
|
|
action = "goto-parent";
|
|
|
|
}
|
|
|
|
|
|
|
|
# {
|
|
|
|
# map = [ "index" "pager" ];
|
|
|
|
# key = mkControlBind key.down;
|
|
|
|
# action = "sidebar-next";
|
|
|
|
# }
|
|
|
|
# {
|
|
|
|
# map = [ "index" "pager" ];
|
|
|
|
# key = mkControlBind key.up;
|
|
|
|
# action = "sidebar-prev";
|
|
|
|
# }
|
|
|
|
# {
|
|
|
|
# map = [ "index" "pager" ];
|
|
|
|
# key = mkControlBind key.right;
|
|
|
|
# action = "sidebar-open";
|
|
|
|
# }
|
|
|
|
# {
|
|
|
|
# map = [ "index" "pager" ];
|
|
|
|
# key = mkControlBind key.left;
|
|
|
|
# action = "sidebar-toggle-visible";
|
|
|
|
# }
|
2023-02-16 12:07:46 -03:00
|
|
|
|
2023-02-18 16:16:01 -03:00
|
|
|
];
|
|
|
|
programs.neomutt.extraConfig = ''
|
|
|
|
source extra
|
|
|
|
'';
|
|
|
|
xdg.configFile."neomutt/extra".source = config.lib.file.mkOutOfStoreSymlink "/home/lelgenio/projects/nixos-config/user/neomutt/neomuttrc";
|
2023-02-16 12:07:46 -03:00
|
|
|
}
|