From eb10e2f9fc9f435a453a3cc06428facb429ff3e4 Mon Sep 17 00:00:00 2001 From: Ray Andrew Date: Wed, 3 Dec 2025 20:55:40 -0600 Subject: [PATCH] more improvement in email ux --- bin/mailcap-open | 5 ++++- config/home/.mailcap | 8 +++++--- config/neomutt/keybinds | 25 ++++++++++++------------- config/neomutt/neomuttrc | 5 +++++ home/email/default.nix | 1 + home/shell.nix | 2 ++ 6 files changed, 29 insertions(+), 17 deletions(-) diff --git a/bin/mailcap-open b/bin/mailcap-open index 54d80e9..e15754c 100755 --- a/bin/mailcap-open +++ b/bin/mailcap-open @@ -49,7 +49,8 @@ text/html) viewers+=("less (text)") ;; text/*) - viewers+=("less") + viewers+=("bat") + viewers+=("nvim (readonly)") ;; esac @@ -65,4 +66,6 @@ case "$selected" in "zathura") zathura "$file" ;; "w3m (browser)") w3m -T text/html "$file" ;; "less"*) less "$file" ;; +"bat") bat --paging=always --style=plain "$file" ;; +"nvim (readonly)") nvim -R "$file" ;; esac diff --git a/config/home/.mailcap b/config/home/.mailcap index 916b999..31ab355 100644 --- a/config/home/.mailcap +++ b/config/home/.mailcap @@ -7,15 +7,17 @@ text/html; ~/dotfiles/bin/path-shim w3m -dump -T text/html %s; copiousoutput text/html; open %s; nametemplate=%s.html # Plain text -text/plain; ~/dotfiles/bin/path-shim TERM=xterm-256color less %s -text/*; ~/dotfiles/bin/path-shim TERM=xterm-256color less %s +text/plain; ~/dotfiles/bin/path-shim bat --paging=always --style=plain %s; needsterminal +text/plain; ~/dotfiles/bin/path-shim nvim -R %s; needsterminal +text/*; ~/dotfiles/bin/path-shim bat --paging=always --style=plain %s; needsterminal +text/*; ~/dotfiles/bin/path-shim nvim -R %s; needsterminal # PDF application/pdf; ~/dotfiles/bin/path-shim zathura %s application/pdf; open %s # Images - terminal -image/*; ~/dotfiles/bin/path-shim chafa %s; needsterminal +image/*; ~/dotfiles/bin/path-shim "chafa %s && read -n1 -p 'Press any key...'"; needsterminal image/*; open %s # Video diff --git a/config/neomutt/keybinds b/config/neomutt/keybinds index 526355f..4798138 100644 --- a/config/neomutt/keybinds +++ b/config/neomutt/keybinds @@ -26,12 +26,12 @@ bind pager,browser G bottom-page bind index G last-entry bind index,pager g noop bind index gg first-entry -bind index D delete-message -bind index U undelete-message +macro index,pager D "" "Delete and sync" +macro index,pager U "" "Undelete and sync" bind index L limit bind index h noop bind index l display-message -bind index R group-reply +bind index,pager R group-reply bind index \031 previous-undeleted bind index \005 next-undeleted bind index sync-mailbox @@ -43,9 +43,6 @@ bind browser l select-entry bind browser,pager,index n search-next bind browser,pager,index N search-opposite -# Navigation (half page) -bind index,pager,browser d half-down -bind index,pager,browser u half-up # Sidebar bind index,pager \Cp sidebar-prev @@ -55,12 +52,9 @@ bind index,pager B sidebar-toggle-visible # Misc bind index,pager @ compose-to-sender -bind index,pager D purge-message # Macros -macro index,pager a ":set confirmappend=no delete=yes\n=Archive\n:set confirmappend=yes delete=ask-yes\n" "Archive" -macro index,pager A ":set confirmappend=no delete=yes\n=Inbox\n:set confirmappend=yes delete=ask-yes\n" "Move to Inbox" -macro index r "N." "Mark as read" + # bind index \Ca noop macro index \Ca "." "Tag all messages" macro index \Cu "." "Untag all messages" @@ -78,12 +72,17 @@ macro index,pager gr "date:7d.." "View recent mail (7 # Compose bind index c mail +bind index,pager E recall-message # Compose menu - PGP shortcuts bind compose S pgp-menu # Mark messages bind index,pager m noop -macro index,pager mu "unset mark_old" "Mark as unread" -macro index,pager mr "N" "Mark as read" -macro index ma ".N." "Mark all as read" +macro index,pager mu "unset mark_old" "Mark as unread" +macro index,pager mr "N" "Mark as read" +macro index,pager m. "." "Tag all messages" +macro index,pager m, "." "Untag all messages" +macro index,pager ma ":set confirmappend=no delete=yes\n=Archive\n:set confirmappend=yes delete=ask-yes\n" "Archive" +macro index,pager mA ":set confirmappend=no delete=yes\n=Inbox\n:set confirmappend=yes delete=ask-yes\n" "Move to Inbox" +macro index,pager mi ":set confirmappend=no delete=yes\n=Important\n:set confirmappend=yes delete=ask-yes\n" "Mark as important" diff --git a/config/neomutt/neomuttrc b/config/neomutt/neomuttrc index 6ca6321..d353b6d 100644 --- a/config/neomutt/neomuttrc +++ b/config/neomutt/neomuttrc @@ -15,6 +15,7 @@ set edit_headers = yes set color_directcolor = yes set implicit_autoview = yes set crypt_use_gpgme = yes +set wait_key = no unset mark_old alternative_order text/enriched text/plain text set delete = yes @@ -40,6 +41,10 @@ set send_charset = "utf-8:iso-8859-1:us-ascii" set charset = "utf-8" set arrow_cursor = "no" +# Signature +set sig_dashes = no # Don't add "-- " before signature (already in file) +set sig_on_top = yes # Put signature above quoted text + # Pager View Options set pager_index_lines = 10 set pager_context = 3 diff --git a/home/email/default.nix b/home/email/default.nix index 82a1be4..7f09c08 100644 --- a/home/email/default.nix +++ b/home/email/default.nix @@ -62,6 +62,7 @@ w3m # HTML rendering zathura # PDF viewer chafa # terminal image viewer + bat # text viewer with syntax highlighting ]; # Symlink config files diff --git a/home/shell.nix b/home/shell.nix index 1bd4b61..e92f736 100644 --- a/home/shell.nix +++ b/home/shell.nix @@ -71,6 +71,7 @@ imagemagick spotify-player eza + bat ] ++ lib.optionals pkgs.stdenv.isDarwin [ coreutils ] ++ (lib.attrValues config.custom.shell.packages); @@ -80,6 +81,7 @@ ll = "eza -la --icons --git"; la = "eza -a --icons"; lt = "eza --tree --level=2 --icons"; + cat = "bat"; }; programs.bash = {