aboutsummaryrefslogtreecommitdiffstats
path: root/modules/programs/neomutt
diff options
context:
space:
mode:
Diffstat (limited to 'modules/programs/neomutt')
-rw-r--r--modules/programs/neomutt/default.nix140
-rw-r--r--modules/programs/neomutt/theme.nix55
2 files changed, 180 insertions, 15 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>";
+ }
];
};
};
diff --git a/modules/programs/neomutt/theme.nix b/modules/programs/neomutt/theme.nix
index 8e57645..60427fc 100644
--- a/modules/programs/neomutt/theme.nix
+++ b/modules/programs/neomutt/theme.nix
@@ -9,10 +9,10 @@
# Base16 OneDark Dark terminal colors for neomutt
# Each column in the index receives a distinct color to keep the UI organized.
- set index_format = "%4C│ %Z │ %{%d/%m %H:%M} │ %-25.25a │ %s"
+ set index_format = " %4C │ %Z │ %{%d/%m %H:%M} │ %-25.25a │ %s%* "
# --- Basic UI Colors --------------------------------------------------
- # fg bg
+ # target foreground background
color normal white default # base05 (Standard text)
color error red default # base08 (Red)
color tilde brightblack default # base03 (Dark Grey)
@@ -20,20 +20,29 @@
color markers red default # base08 (Red)
color attachment magenta default # base0E (Magenta)
color search magenta default # base0E (Magenta)
+ color prompt cyan default # base0C (Questions/prompts)
+ color progress black yellow # base0A bg (Progress bar)
# Selected row and status bar
- color status white brightblack # base05 on base03
- color indicator black blue # base00 on base0D (Selected email)
- color tree brightblack default # base03 (Thread arrows)
+ color status white brightblack # base05 on base03
+ color indicator default brightblack # default on base03 (Selected email)
+ color tree magenta default # base03 (Thread arrows)
+
+ # Whole-line fallback for the index (base for anything not caught below)
+ color index white default # base05
# --- Index Columns (The Multi-Color Table) ----------------------------
# Applies distinct colors to specific columns for ALL messages (~A)
- color index_number white default "~A" # base05 (Fixed: was brightblack)
- color index_date green default "~A" # base0B (Green)
- color index_flags red default "~A" # base08 (Red)
- color index_size cyan default "~A" # base0C (Cyan)
- color index_author yellow default "~A" # base0A (Yellow)
- color index_subject white default "~A" # base05 (Standard text for Read messages)
+ color index_number cyan default "~A" # base05 (Fixed: was brightblack)
+ color index_date green default "~A" # base0B (Green)
+ color index_flags red default "~A" # base08 (Red)
+ color index_size cyan default "~A" # base0C (Cyan)
+ color index_author yellow default "~A" # base0A (Yellow)
+ color index_subject white default "~A" # base05 (Standard text for Read messages)
+ color index_collapsed yellow default # base0A (Collapsed thread count, %M)
+ color index_label magenta default # base0E (Message label, %y %Y)
+ color index_tag cyan default # base0C (Message tags, %G)
+ color index_tags cyan default # base0C (Transformed tags, %g %J)
# --- Index Message States ---------------------------------------------
# By targeting *only* `index_subject`, we preserve your multi-color
@@ -57,11 +66,18 @@
color index_subject blue default "~v~(~N)" # Collapsed with unread inside
color index_subject red default "~v~(~F)" # Collapsed with flagged inside
+ # Subtle zebra striping between adjacent index rows (barely-there contrast)
+ color stripe_odd default default
+ color stripe_even default default
+
# --- Message Headers --------------------------------------------------
color hdrdefault cyan default # base0C
color header yellow default "^(From|To|Cc|Bcc)" # base0A
color header blue default "^(Subject)" # base0D
- color header brightblack default "^(Date)" # base03
+ color header green default "^(Date)" # base03
+
+ # Attachment header lines (shown above each MIME part in the pager)
+ color attach_headers cyan default
# --- Message Body -----------------------------------------------------
color quoted blue default # base0D
@@ -69,6 +85,11 @@
color quoted2 yellow default # base0A
color quoted3 red default # base08
color quoted4 magenta default # base0E
+ color quoted5 blue default # base0D (cycle repeats)
+ color quoted6 cyan default # base0C
+ color quoted7 yellow default # base0A
+ color quoted8 red default # base08
+ color quoted9 magenta default # base0E
color signature green default # base0B
color bold white default # base05
@@ -81,5 +102,15 @@
color body green default "(Good signature)"
color body red default "(BAD signature)"
color body brightblack default "^gpg: "
+
+ # --- Sidebar (was completely unset despite sidebar.enable = true) -----
+ color sidebar_background default default # transparent, blends with terminal bg
+ color sidebar_divider white default # base03 (matches old tree color)
+ color sidebar_ordinary white default # base05 (normal mailbox entries)
+ color sidebar_new green default # base0B (mailboxes with new mail)
+ color sidebar_flagged red default # base08 (mailboxes with flagged mail)
+ color sidebar_spool_file yellow default # base0A (your inbox/spool)
+ color sidebar_highlight white brightblack # base05 on base03 (cursor position)
+ color sidebar_indicator default brightblack # default on base03 (currently open mailbox)
'';
}