diff options
| author | Arpit Chakladar <arpitchakladar+git@gmail.com> | 2026-07-11 03:59:33 +0530 |
|---|---|---|
| committer | Arpit Chakladar <arpitchakladar+git@gmail.com> | 2026-07-11 03:59:33 +0530 |
| commit | b71db736d1cdc93a2d0b1d477ab8572c1187799e (patch) | |
| tree | b36bc6c451b1edd356203bd0001c54fbba86e677 /modules/programs/neomutt/default.nix | |
| parent | a9fdb6d4358c8d34da52d13a960aa36182b65474 (diff) | |
| download | home-manager-config-b71db736d1cdc93a2d0b1d477ab8572c1187799e.tar.gz home-manager-config-b71db736d1cdc93a2d0b1d477ab8572c1187799e.zip | |
feat(neomutt): add keybindings, sidebar colors, mailcap, and urlscan integration
- Remap sidebar-open from Ctrl+O to 'o' for single-key access
- Add Enter/l/h/0/$ keybindings across index, pager, and browser modes
- Add macros: O (mbsync sync), gx (urlscan link extraction), gl (flag legend)
- Add extraConfig with abort_key, mailcap_path, and auto_view for attachments
- Add mailcap for w3m/html, image/pdf/video/audio openers via xdg-open
- Add flag_legend.txt help file accessible via 'gl'
- Add home.packages for urlscan and w3m
- Add checkStatsInterval = 20
- Add sidebar colors (background, divider, ordinary, new, flagged, spool_file, highlight, indicator)
- Add prompt, progress, stripe_odd/stripe_even, and attach_headers colors
- Add index_collapsed, index_label, index_tag, and index_tags color targets
- Fix indicator to use brightblack background instead of blue for better contrast
- Extend quoted colors from 4 to 9 levels for deeply nested replies
- Change Date header color to green
- Update index_format with padding for cleaner alignment
- Add mailboxes, Expunge = Both, and notmuch virtual mailboxes to email example
Diffstat (limited to 'modules/programs/neomutt/default.nix')
| -rw-r--r-- | modules/programs/neomutt/default.nix | 140 |
1 files changed, 137 insertions, 3 deletions
diff --git a/modules/programs/neomutt/default.nix b/modules/programs/neomutt/default.nix index 940ce9a..e489328 100644 --- a/modules/programs/neomutt/default.nix +++ b/modules/programs/neomutt/default.nix @@ -2,21 +2,76 @@ { config, lib, + pkgs, ... }: - { imports = [ ./assertions.nix ./theme.nix ]; - config = lib.mkIf config.programs.neomutt.enable { + home.packages = [ + pkgs.urlscan + pkgs.w3m + ]; + + xdg.configFile."neomutt/mailcap".text = '' + text/html; w3m -dump -T text/html '%s'; copiousoutput; nametemplate=%s.html + text/html; $BROWSER '%s'; nametemplate=%s.html + image/*; xdg-open '%s' & + application/pdf; xdg-open '%s'; nametemplate=%s.pdf + video/*; xdg-open '%s' & + audio/*; xdg-open '%s' & + application/*; xdg-open '%s' & + ''; + + xdg.configFile."neomutt/flag_legend.txt".text = '' + NeoMutt Index Flags + =================== + + Message state ($flag_chars) + N New - unread, arrived since you last checked + O Old - unread, but seen in a previous session + D Deleted - marked for deletion (pending expunge) + d Att-del - has attachments marked for deletion + ! Flagged - important (toggle with F) + * Tagged - selected for a bulk operation (toggle with t) + r Replied - you've replied to this message + S Signed - PGP/SMIME signed + P Encrypted - PGP/SMIME encrypted + s Cert - contains a S/MIME certificate/key + K PGP key - contains a PGP public key + (blank) - read, nothing else notable + + Addressing ($to_chars) + + To you only - sent to you and only you + T To (with others) - you're in the To: list, among others + C Cc only - you're only in the Cc: list + F From you - sent by you + L Mailing list - sent to a list you're subscribed to + (blank) - not in To/Cc (e.g. Bcc, unlisted) + + Press q to close. + ''; + programs.neomutt = { sidebar.enable = true; sort = "reverse-threads"; vimKeys = true; unmailboxes = true; + checkStatsInterval = 20; + + extraConfig = '' + # cancel any prompt/command-line entry with Esc, vim-style + set abort_key = "<Esc>" + + # attachments: use our mailcap for dedicated openers, + # and auto-render html/images inline where sensible + set mailcap_path = "~/.config/neomutt/mailcap" + auto_view text/html image/png image/jpeg image/gif application/pdf + ''; + binds = [ { map = [ @@ -35,13 +90,75 @@ action = "sidebar-next"; } { + # select the highlighted mailbox directly, no Ctrl+O needed map = [ "index" "pager" ]; - key = "\\CO"; + key = "o"; action = "sidebar-open"; } + + { + map = [ "index" ]; + key = "<Return>"; + action = "display-message"; + } + { + map = [ "browser" ]; + key = "<Return>"; + action = "select-entry"; + } + { + map = [ "attach" ]; + key = "<Return>"; + action = "view-attach"; + } + { + map = [ + "alias" + "query" + ]; + key = "<Return>"; + action = "select-entry"; + } + { + map = [ "pager" ]; + key = "<Return>"; + action = "next-page"; + } + + { + map = [ "index" ]; + key = "l"; + action = "display-message"; + } + { + map = [ "pager" ]; + key = "h"; + action = "exit"; + } + { + map = [ "pager" ]; + key = "l"; + action = "next-unread"; + } + { + map = [ "index" ]; + key = "h"; + action = "collapse-thread"; + } + + { + map = [ "pager" ]; + key = "0"; + action = "top"; + } + { + map = [ "pager" ]; + key = "$"; + action = "bottom"; + } ]; macros = [ @@ -53,6 +170,23 @@ key = "O"; action = "<sync-mailbox><shell-escape>mbsync -a<enter><sync-mailbox>"; } + { + # gx: extract links from the current message and open one, vim-netrw style + map = [ + "index" + "pager" + ]; + key = "gx"; + action = "<pipe-message>urlscan<Enter>"; + } + { + map = [ + "index" + "pager" + ]; + key = "gl"; + action = "<shell-escape>less ~/.config/neomutt/flag_legend.txt<enter>"; + } ]; }; }; |
