{ config, lib, pkgs, ... }: let cfg = config.modules.aerc; in { options.modules.aerc = { enable = lib.mkEnableOption "aerc"; }; config = lib.mkIf cfg.enable { programs.aerc = { enable = true; extraConfig = { general = { unsafe-accounts-conf = true; default-menu-cmd = "fzf --tmux"; }; ui = { this-day-time-format="03:04 PM"; this-year-time-format="2006-01-02"; dirlist-tree=true; dirlipse-collapse=1; sidebar-width = 20; }; "ui:folder=Sent" = { index-columns = "date<20,name<17,flags>4,subject<*"; column-name = "{{index (.To | names) 0}}"; }; filters = { "subject,~^\\[PATCH"="hldiff"; "subject,~^\\[RFC"="hldiff"; "text/*" = "plaintext"; "text/calendar" = "calendar"; "text/html" = "html | colorize"; "message/delivery-status" = "colorize"; "message/rfc822" = "colorize"; }; viewer = { # pager = "nvim +Man!"; pager = "less -Rc"; }; }; extraBinds = { global = { "\\[t" = ":prev-tab"; "\\]t" = ":next-tab"; "" = ":term"; "" = ":help keys"; "" = ":prompt 'Quit?' quit"; "" = ":prompt 'Quit?' quit"; "" = ":suspend"; }; "messages:folder=Drafts"."" = ":recall"; messages = { /** * CUSTOM SECTION ** */ "n" = ":next"; "e" = ":prev"; N = ":next-folder"; E = ":prev-folder"; j = ":next-result"; J = ":prev-result"; /** * ** */ g = ":select 0"; G = ":select -1"; "T" = ":toggle-threads"; "zc" = ":fold"; "zo" = ":unfold"; "za" = ":fold -t"; "zM" = ":fold -a"; "zR" = ":unfold -a"; "" = ":fold -t"; "" = ":view"; "d" = ":choose -o y 'Really delete this message' delete-message"; "D" = ":delete"; "a" = ":archive flat"; "A" = ":unmark -a:mark -T:archive flat"; "C" = ":compose"; "b" = ":bounce"; "rr" = ":reply -a"; "rq" = ":reply -aq"; "Rr" = ":reply"; "Rq" = ":reply -q"; "c" = ":cf"; "$" = ":term"; "!" = ":term"; "|" = ":pipe"; "/" = ":search"; "\\" = ":filter"; "" = ":clear"; "s" = ":split"; "S" = ":vsplit"; "pl" = ":patch list"; "pa" = ":patch apply "; "pd" = ":patch drop "; "pb" = ":patch rebase"; "pt" = ":patch term"; "ps" = ":patch switch "; }; view = { "/" = ":toggle-key-passthrough/"; "q" = ":close"; "O" = ":open"; "o" = ":open"; "S" = ":save"; "|" = ":pipe"; "D" = ":delete"; "A" = ":archive flat"; "" = ":copy-link "; "" = ":open-link "; "f" = ":forward"; "rr" = ":reply -a"; "rq" = ":reply -aq"; "Rr" = ":reply"; "Rq" = ":reply -q"; "H" = ":toggle-headers"; "" = ":prev-part"; "" = ":next-part"; "N" = ":next"; "E" = ":prev"; }; compose = { "$noinherit" = "true"; "$ex" = ""; "$complete" = ""; "" = ":next-field"; "" = ":prev-field"; "" = ":switch-account -p"; "" = ":switch-account -n"; "" = ":next-field"; "" = ":prev-field"; "" = ":prev-tab"; "" = ":next-tab"; }; "compose::review" = { "y" = ":send"; "n" = ":abort"; "s" = ":sign"; "x" = ":encrypt"; "v" = ":preview"; "p" = ":postpone"; "q" = ":choose -o d discard abort -o p postpone postpone"; "e" = ":edit"; "a" = ":attach"; "d" = ":detach"; }; "compose::editor" = { "$noinherit" = "true"; "$ex" = ""; }; terminal = { "$noinherit" = "true"; "$ex" = ""; "" = ":prev-tab"; "" = ":next-tab"; }; }; }; }; }