feat(neomutt): add terminal mail client

This commit is contained in:
Sergio Laín 2025-09-21 17:34:27 +02:00
parent 67e0426c5f
commit 48af1d9bfb
No known key found for this signature in database
GPG key ID: 51BB28D8B42FB438
10 changed files with 269 additions and 0 deletions

22
.config/isyncrc Normal file
View file

@ -0,0 +1,22 @@
# Remote Vault
IMAPStore proton-remote
Account proton
# Local Vault
MaildirStore proton-local
Path ~/.mail/proton/
Inbox ~/.mail/proton/INBOX
Subfolders Verbatim
# Sync Channel
Channel proton-default
Far :proton-remote:
Near :proton-local:
Patterns * !"All Mail"
Create Both
Expunge Both
SyncState *
# Sync Inbox
Group proton
Channel proton-default

3
.config/neomutt/.github/README.md vendored Normal file
View file

@ -0,0 +1,3 @@
<div align="center">
<a href=""><img src="./title.png"></a>
</div>

BIN
.config/neomutt/.github/title.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

52
.config/neomutt/binds Normal file
View file

@ -0,0 +1,52 @@
# vim: filetype=muttrc
#------------------------------------------------------------
# Vi Key Bindings
#------------------------------------------------------------
# Moving around
bind attach,browser,index g noop
bind attach,browser,index gg first-entry
bind attach,browser,index G last-entry
bind pager g noop
bind pager gg top
bind pager G bottom
bind pager k previous-line
bind pager j next-line
# Scrolling
bind attach,browser,pager,index \CF next-page
bind attach,browser,pager,index \CB previous-page
bind attach,browser,pager,index \Cu half-up
bind attach,browser,pager,index \Cd half-down
bind browser,pager \Ce next-line
bind browser,pager \Cy previous-line
bind index \Ce next-line
bind index \Cy previous-line
bind pager,index d noop
bind pager,index dd delete-message
# Mail & Reply
bind index \Cm list-reply # Doesn't work currently
# Threads
bind browser,pager,index N search-opposite
bind pager,index dT delete-thread
bind pager,index dt delete-subthread
bind pager,index gt next-thread
bind pager,index gT previous-thread
bind index za collapse-thread
bind index zA collapse-all # Missing :folddisable/foldenable
bind attach <return> view-mailcap
bind attach l view-mailcap
bind index,pager B sidebar-toggle-visible
macro compose A "<shell-escape>bash $HOME/.config/neomutt/scripts/filepicker<enter><enter-command>source $HOME/.config/neomutt/tmpfile<enter><shell-escape>bash $HOME/.config/neomutt/scripts/filepicker clean<enter>" "Attach with yazi"
# Go to specific folder
macro index gd "<change-folder>$postponed<enter>" "go to drafts"
macro index gs "<change-folder>$record<enter>" "go to sent"
macro index gi "<change-folder>$spoolfile<Enter>" "go to inbox"
macro index gt "<change-folder>$trash<enter>" "go to trash"

16
.config/neomutt/mailcap Normal file
View file

@ -0,0 +1,16 @@
# MS Word documents
application/msword; xdg-open %s
application/vnd.ms-excel; xdg-open %s
application/vnd.openxmlformats-officedocument.presentationml.presentation; xdg-open %s
application/vnd.oasis.opendocument.text; xdg-open %s
# HTML
text/html; w3m -o auto_image=TRUE -I %{charset} -T text/html; copiousoutput;
text/plain; nvim %s
# PDF
application/pdf; xdg-open %s
# Images
image/png; xdg-open %s
image/jpeg; xdg-open %s

View file

@ -0,0 +1,8 @@
# vim: filetype=muttrc
# Accounts
source "~/.config/neomutt/accounts/account.com.example"
# Source Files
source "~/.config/neomutt/binds"
source "~/.config/neomutt/options"
source "~/.config/neomutt/theme"

43
.config/neomutt/options Normal file
View file

@ -0,0 +1,43 @@
# vim: filetype=muttrc
# General settings
set editor='nvim'
set attach_save_dir="~/downloads/mail-attachments"
set mailcap_path = ~/.config/neomutt/mailcap
# Open mails on html view by default
auto_view text/html text/calendar
alternative_order text/calendar text/plain text/enriched text/html text/*
set sidebar_visible=yes
set sidebar_width=30
set sidebar_short_path=yes
set pager_stop # don't go to next message automatically
set menu_scroll # scroll in menus
set pager_format="%4C %Z %[!%b %e at %I:%M %p] %.20n %s%* -- (%P)"
set wait_key=no
set smart_wrap
set reflow_wrap=120
set reflow_text
set attach_format = '%u%D%I %t%4n %T%.40d%> [%.12m/%.12M, %.6e%?C?, %C?, %s] '
set folder_format = '%4C %t %f'
# Index View Options ---------------------------------
set date_format = "%d/%m/%y at %H:%M"
# Status Bar {{{
set status_chars = '—+#~'
set status_on_top = yes
## status_format - format of summary on the current folder in the index
# https://www.neomutt.org/guide/reference.html#status-format
##
## %?<sequence_char>?<optional_string>? optionally print string, if>0
## Default: -%r-NeoMutt: %f [Msgs:%?M?%M/?%m%?n? New:%n?%?o? Old:%o?%?d? Del:%d?%?F? Flag:%F?%?t? Tag:%t?%?p? Post:%p?%?b? Inc:%b?%?l? %l?]---(%s/%S)-%>-(%P)---
# set status_format = "%f%r—[%?M?%M/?%m messages, %?n?%n new, ?%?d?%d deleted, ?%?F?%F important, ?%?t?%t selected, ?%?p?%p drafts, ?%l]———(%s/%S)—%>—(%P)———"
set status_format = "%D %?u?[ %u] ?%?R?[ %R] ?%?d?[ %d] ?%?t?[ %t] ?%?F?[ %F] ?%?p?[ %p]? \n \n"
# Default is: Mutt with %?m?%m messages&no messages?%?n? [%n NEW]?
set ts_status_format = 'mutt %m messages%?n?, %n new?'

View file

@ -0,0 +1,10 @@
#!/bin/sh
tmpfile=$HOME/.config/neomutt/tmpdir
if \[ -z "$1" \]; then
yazi --cwd-file $tmpfile &&
echo "$(awk 'BEGIN {printf "%s", "push "} {printf "%s", "<save-entry>\""$0"\"<enter>"}' $tmpfile)" >$tmpfile
elif \[ $1 == "clean" \]; then
rm $tmpfile
fi

View file

@ -0,0 +1,11 @@
#!/bin/sh
tmpfile=$HOME/.config/neomutt/tmpfile
if \[ -z "$1" \]; then
yazi --chooser-file $tmpfile &&
sed -i 's/ /^V /g' $tmpfile &&
echo "$(awk 'BEGIN {printf "%s", "push "} {printf "%s", "<attach-file>\""$0"\"<enter>"}' $tmpfile)" >$tmpfile
elif \[ $1 == "clean" \]; then
rm $tmpfile
fi

104
.config/neomutt/theme Normal file
View file

@ -0,0 +1,104 @@
# vim: filetype=muttrc
# Header colors:
color header blue default ".*"
color header brightmagenta default "^(From)"
color header brightcyan default "^(Subject)"
color header brightwhite default "^(CC|BCC)"
mono bold bold
mono underline underline
mono indicator reverse
mono error bold
color normal default default
color indicator brightyellow default # currently selected message. default makes bar clear, disabled arrow to save space.
color sidebar_highlight red default
color sidebar_divider brightblack black
color sidebar_flagged red black
color sidebar_new green black
color normal brightyellow default
color error red default
color tilde black default
color message cyan default
color markers red white
color attachment white default
color search brightmagenta color0
color status brightyellow black
color hdrdefault brightgreen default
color quoted green default
color quoted1 blue default
color quoted2 cyan default
color quoted3 yellow default
color quoted4 red default
color quoted5 brightred default
color signature brightgreen default
color bold black default
color underline black default
color normal default default
color body brightred default "[\-\.+_a-zA-Z0-9]+@[\-\.a-zA-Z0-9]+" # Email addresses
color body brightblue default "(https?|ftp)://[\-\.,/%~_:?&=\#a-zA-Z0-9]+" # URL
color body green default "\`[^\`]*\`" # Green text between ` and `
color body brightblue default "^# \.*" # Headings as bold blue
color body brightcyan default "^## \.*" # Subheadings as bold cyan
color body brightgreen default "^### \.*" # Subsubheadings as bold green
color body yellow default "^(\t| )*(-|\\*) \.*" # List items as yellow
color body brightcyan default "[;:][-o][)/(|]" # emoticons
color body brightcyan default "[;:][)(|]" # emoticons
color body brightcyan default "[ ][*][^*]*[*][ ]?" # more emoticon?
color body brightcyan default "[ ]?[*][^*]*[*][ ]" # more emoticon?
color body red default "(BAD signature)"
color body cyan default "(Good signature)"
color body brightblack default "^gpg: Good signature .*"
color body brightyellow default "^gpg: "
color body brightyellow red "^gpg: BAD signature from.*"
mono body bold "^gpg: Good signature"
mono body bold "^gpg: BAD signature from.*"
color body red default "([a-z][a-z0-9+-]*://(((([a-z0-9_.!~*'();:&=+$,-]|%[0-9a-f][0-9a-f])*@)?((([a-z0-9]([a-z0-9-]*[a-z0-9])?)\\.)*([a-z]([a-z0-9-]*[a-z0-9])?)\\.?|[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+)(:[0-9]+)?)|([a-z0-9_.!~*'()$,;:@&=+-]|%[0-9a-f][0-9a-f])+)(/([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*(;([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*)*(/([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*(;([a-z0-9_.!~*'():@&=+$,-]|%[0-9a-f][0-9a-f])*)*)*)?(\\?([a-z0-9_.!~*'();/?:@&=+$,-]|%[0-9a-f][0-9a-f])*)?(#([a-z0-9_.!~*'();/?:@&=+$,-]|%[0-9a-f][0-9a-f])*)?|(www|ftp)\\.(([a-z0-9]([a-z0-9-]*[a-z0-9])?)\\.)*([a-z]([a-z0-9-]*[a-z0-9])?)\\.?(:[0-9]+)?(/([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*(;([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*)*(/([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*(;([-a-z0-9_.!~*'():@&=+$,]|%[0-9a-f][0-9a-f])*)*)*)?(\\?([-a-z0-9_.!~*'();/?:@&=+$,]|%[0-9a-f][0-9a-f])*)?(#([-a-z0-9_.!~*'();/?:@&=+$,]|%[0-9a-f][0-9a-f])*)?)[^].,:;!)? \t\r\n<>\"]"
# Default index colors:
color index yellow default '.*'
color index_author red default '.*'
color index_number blue default
color index_subject cyan default '.*'
# For new mail:
color index brightyellow black "~N"
color index_author brightred black "~N"
color index_subject brightcyan black "~N"
color progress black cyan
# color normal default default # Text is "Text"
# color index color2 default ~N # New Messages are Green
# color index color1 default ~F # Flagged messages are Red
# color index color13 default ~T # Tagged Messages are Red
# color index color1 default ~D # Messages to delete are Red
# color attachment color5 default # Attachments are Pink
# color signature color8 default # Signatures are Surface 2
# color search color4 default # Highlighted results are Blue
#
# color indicator default color8 # currently highlighted message Surface 2=Background Text=Foreground
# color error color1 default # error messages are Red
# color status color15 default # status line "Subtext 0"
# color tree color15 default # thread tree arrows Subtext 0
# color tilde color15 default # blank line padding Subtext 0
#
# color hdrdefault color13 default # default headers Pink
# color header color13 default "^From:"
# color header color13 default "^Subject:"
#
# color quoted color15 default # Subtext 0
# color quoted1 color7 default # Subtext 1
# color quoted2 color8 default # Surface 2
# color quoted3 color0 default # Surface 1
# color quoted4 color0 default
# color quoted5 color0 default
#
# color body color2 default [\-\.+_a-zA-Z0-9]+@[\-\.a-zA-Z0-9]+ # email addresses Green
# color body color2 default (https?|ftp)://[\-\.,/%~_:?&=\#a-zA-Z0-9]+ # URLs Green
# color body color4 default (^|[[:space:]])\\*[^[:space:]]+\\*([[:space:]]|$) # *bold* text Blue
# color body color4 default (^|[[:space:]])_[^[:space:]]+_([[:space:]]|$) # _underlined_ text Blue
# color body color4 default (^|[[:space:]])/[^[:space:]]+/([[:space:]]|$) # /italic/ text Blue
#
# color sidebar_flagged color1 default # Mailboxes with flagged mails are Red
# color sidebar_new color10 default # Mailboxes with new mail are Green