@@ -61,7 +61,7 @@ If you get errors in `neomutt`, install the most recent version manually or manu | |||||
Install it and run `notmuch setup`. | Install it and run `notmuch setup`. | ||||
Tell it where your mail is (`$MAILDIR` or `~/Mail`). | Tell it where your mail is (`$MAILDIR` or `~/Mail`). | ||||
Although, `mw` will do this automatically, if you haven't set notmuch up before. | Although, `mw` will do this automatically, if you haven't set notmuch up before. | ||||
You can run it in mutt with `ctrl-f`. | |||||
You can run it in mutt with `S`. | |||||
Run `notmuch new` to process new mail. | Run `notmuch new` to process new mail. | ||||
Although, the included `mailsync` script does this for you. | Although, the included `mailsync` script does this for you. | ||||
- `libnotify`/`libnotify-bin` - allows notifications when syncing mail with `mailsync` | - `libnotify`/`libnotify-bin` - allows notifications when syncing mail with `mailsync` | ||||
@@ -71,28 +71,34 @@ If you get errors in `neomutt`, install the most recent version manually or manu | |||||
- `pam-gnupg` - this is a more general program that I use. | - `pam-gnupg` - this is a more general program that I use. | ||||
It automatically logs you into your GPG key on login so you will never need to input your password once logged on to your system. | It automatically logs you into your GPG key on login so you will never need to input your password once logged on to your system. | ||||
Check out the repo and directions [here](https://github.com/cruegge/pam-gnupg). | Check out the repo and directions [here](https://github.com/cruegge/pam-gnupg). | ||||
- `urlview` - outputs urls in mail to browser. | |||||
- `urlscan` - outputs urls in mail to browser. | |||||
## Neomutt user interface | ## Neomutt user interface | ||||
To give you an example of the interface, here's an idea: | To give you an example of the interface, here's an idea: | ||||
- `m` - send mail (uses your default `$EDITOR` to write) | - `m` - send mail (uses your default `$EDITOR` to write) | ||||
- `j`/`k` and `d`/`u` - vim-like bindings to go down and up (or `d`/`u` to go down/up a page). | |||||
- `j`/`k` and `ctrl-d`/`ctrl-u` - vim-like bindings to go down and up | |||||
- `l` - open mail, or attachment page or attachment | - `l` - open mail, or attachment page or attachment | ||||
- `h` - the opposite of `l` | - `h` - the opposite of `l` | ||||
- `D` - delete mail | - `D` - delete mail | ||||
- `r`/`R` - reply/reply all to highlighted mail | |||||
- `r`/`gr` - reply/reply all to highlighted mail | |||||
- `s` - save selected mail or selected attachment | - `s` - save selected mail or selected attachment | ||||
- `gs`,`gi`,`ga`,`gd`,`gS` - Press `g` followed by another letter to change mailbox: `s`ent, `i`nbox, `a`rchive, `d`rafts, `S`pam, etc. | |||||
- `M` and `C` - For `M`ove and `C`opy: follow them with one of the mailbox letters above, i.e. `MS` means "move to Spam". | |||||
- `ixy` - Press `i` followed by the two initial mailbox letters to go there | |||||
- `Mxy` and `Cxy` - For `M`ove and `C`opy to the according mailbox, e.g. `Msp` means "move to Spam". | |||||
- `i#` - Press `i` followed by a number 1-9 to go to a different account. | - `i#` - Press `i` followed by a number 1-9 to go to a different account. | ||||
If you add 9 accounts via mutt-wizard, they will each be assigned a number. | If you add 9 accounts via mutt-wizard, they will each be assigned a number. | ||||
- `a` to add address/person to abook and `Tab` while typing address to complete one from book. | |||||
- `ga` to add address/person to abook and `Tab` while typing address to complete one from book. | |||||
- `?` - see all keyboard shortcuts | - `?` - see all keyboard shortcuts | ||||
- `ctrl-j`/`ctrl-k` - move up and down in sidebar, `ctrl-o` opens mailbox. | |||||
- `ctrl-b` - open a menu to select a url you want to open in you browser (needs urlview). | |||||
- `ctrl-j`/`ctrl-k` - move up and down in sidebar, `ctrl-l` opens mailbox. | |||||
- `gu` - open a menu to select a url you want to open in you browser (needs urlscan). | |||||
- `S` - search for a mail | |||||
- `gl` - limit by substring of subject | |||||
- `gL` - undo limit | |||||
- `gm / gM` - call mutt-wizard's mailsync for one / all mail accounts | - `gm / gM` - call mutt-wizard's mailsync for one / all mail accounts | ||||
- `^u` within input field / command line, will clear it, `^a` and `^e` go to beginning or end, `^g` aborts | |||||
Look into `/usr/share/mutt-wizard.muttrc` to see all bindings. | |||||
## New stuff and improvements since the original release | ## New stuff and improvements since the original release | ||||
@@ -12,16 +12,17 @@ export DISPLAY=:0.0 | |||||
if [[ -z $PASSWORD_STORE_DIR ]]; then | if [[ -z $PASSWORD_STORE_DIR ]]; then | ||||
[ -d "$HOME/.local/share/password-store" ] && export PASSWORD_STORE_DIR="$HOME/.local/share/password-store" | [ -d "$HOME/.local/share/password-store" ] && export PASSWORD_STORE_DIR="$HOME/.local/share/password-store" | ||||
fi | fi | ||||
configdir=${XDG_CONFIG_HOME:-$HOME/.config} | |||||
maildir="${MAILDIR:-$HOME/Mail}" | |||||
lastrun=${XDG_CACHE_HOME:-$HOME/.cache}/.mailsynclastrun | |||||
mbsyncrc="$configdir/isync/mbsyncrc" | |||||
mbsyncbin="$prefix/bin/mbsync -c $mbsyncrc" | |||||
mwconfigdir=${XDG_CONFIG_HOME:-$HOME/.config} | |||||
mwmaildir="${MAILDIR:-$HOME/Mail}" | |||||
mwlastrun=${XDG_CACHE_HOME:-$HOME/.cache}/.mailsynclastrun | |||||
mwmbsyncrc="$mwconfigdir/isync/mbsyncrc" | |||||
mwmbsyncbin="$prefix/bin/mbsync -c $mwmbsyncrc" | |||||
# Run only if user logged in (prevent cron errors) | # Run only if user logged in (prevent cron errors) | ||||
pgrep -u "$USER" >/dev/null || { echo "$USER not logged in; sync will not run."; exit ;} | pgrep -u "$USER" >/dev/null || { echo "$USER not logged in; sync will not run."; exit ;} | ||||
# Run only if not already running in other instance | # Run only if not already running in other instance | ||||
pgrep -x mbsync >/dev/null && { echo "mbsync is already running." ; exit ;} | |||||
pgrep -x mbsync >/dev/null && { echo "mbsync is running." ; exit ;} | |||||
pgrep -x notmuch >/dev/null && { echo "notmuch is running." ; exit ;} | |||||
# Checks for internet connection and set notification script. | # Checks for internet connection and set notification script. | ||||
ping -q -c 1 1.1.1.1 > /dev/null || { echo "No internet connection detected."; exit ;} | ping -q -c 1 1.1.1.1 > /dev/null || { echo "No internet connection detected."; exit ;} | ||||
@@ -29,20 +30,21 @@ command -v notify-send >/dev/null || echo "Note that \`libnotify\` or \`libnotif | |||||
# Settings are different for MacOS (Darwin) systems. | # Settings are different for MacOS (Darwin) systems. | ||||
if [ "$(uname)" = "Darwin" ]; then | if [ "$(uname)" = "Darwin" ]; then | ||||
notify() { osascript -e "display notification \"$2 in $1\" with title \"You've got Mail\" subtitle \"Account: $account\"" && sleep 2 ;} | |||||
notify() { osascript -e "display notification \"$2 in $1\" with title \"You've got Mail\" subtitle \"Account: $1\"" && sleep 2 ;} | |||||
else | else | ||||
notify() { notify-send "mutt-wizard" "📬 $2 new mail(s) in \`$1\` account." ;} | notify() { notify-send "mutt-wizard" "📬 $2 new mail(s) in \`$1\` account." ;} | ||||
fi | fi | ||||
# Check account for new mail. Notify if there is new content. | # Check account for new mail. Notify if there is new content. | ||||
syncandnotify() { | syncandnotify() { | ||||
acc="$(echo "$account" | sed "s/.*\///")" | |||||
$mbsyncbin "$acc" | |||||
new=$(find "$maildir/$acc/INBOX/new/" "$maildir/$acc/Inbox/new/" "$maildir/$acc/inbox/new/" -type f -newer "$lastrun" 2> /dev/null) | |||||
newcount=$(echo "$new" | sed '/^\s*$/d' | wc -l) | |||||
mwacc="$(echo "$mwaccount" | sed "s/.*\///")" | |||||
mwaccmaildir="$mwmaildir/$mwacc" | |||||
$mwmbsyncbin "$mwacc" | |||||
mwnew=$(find "$mwaccmaildir/INBOX/new/" "$mwaccmaildir/Inbox/new/" "$mwaccmaildir/inbox/new/" -type f -newer "$mwlastrun" 2> /dev/null) | |||||
newcount=$(echo "$mwnew" | sed '/^\s*$/d' | wc -l) | |||||
if [ "$newcount" -gt "0" ]; then | if [ "$newcount" -gt "0" ]; then | ||||
notify "$acc" "$newcount" & | |||||
for file in $new; do | |||||
notify "$mwacc" "$newcount" & | |||||
for file in $mwnew; do | |||||
# Extract subject and sender from mail. | # Extract subject and sender from mail. | ||||
from=$(awk '/^From: / && ++n ==1,/^\<.*\>:/' "$file" | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' | awk '{ $1=""; if (NF>=3)$NF=""; print $0 }' | sed 's/^[[:blank:]]*[\"'\''\<]*//;s/[\"'\''\>]*[[:blank:]]*$//') | from=$(awk '/^From: / && ++n ==1,/^\<.*\>:/' "$file" | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' | awk '{ $1=""; if (NF>=3)$NF=""; print $0 }' | sed 's/^[[:blank:]]*[\"'\''\<]*//;s/[\"'\''\>]*[[:blank:]]*$//') | ||||
subject=$(awk '/^Subject: / && ++n == 1,/^\<.*\>: / && ++i == 2' "$file" | head -n-1 | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' | sed 's/^Subject: //' | sed 's/^{[[:blank:]]*[\"'\''\<]*//;s/[\"'\''\>]*[[:blank:]]*$//' | tr -d '\n') | subject=$(awk '/^Subject: / && ++n == 1,/^\<.*\>: / && ++i == 2' "$file" | head -n-1 | perl -CS -MEncode -ne 'print decode("MIME-Header", $_)' | sed 's/^Subject: //' | sed 's/^{[[:blank:]]*[\"'\''\<]*//;s/[\"'\''\>]*[[:blank:]]*$//' | tr -d '\n') | ||||
@@ -53,17 +55,17 @@ syncandnotify() { | |||||
# Sync accounts passed as argument or all. | # Sync accounts passed as argument or all. | ||||
if [ "$#" -eq "0" ]; then | if [ "$#" -eq "0" ]; then | ||||
accounts="$(awk '/^Group .*@.*/ {print $2}' "$mbsyncrc")" | |||||
accounts+=" $(awk '/^Channel .*@.*/ {print $2}' "$mbsyncrc")" | |||||
mwaccounts="$(awk '/^Group .*@.*/ {print $2}' "$mwmbsyncrc")" | |||||
mwaccounts+=" $(awk '/^Channel .*@.*/ {print $2}' "$mwmbsyncrc")" | |||||
else | else | ||||
accounts=$* | |||||
mwaccounts=$* | |||||
fi | fi | ||||
echo " 🔃" > /tmp/imapsyncicon_"$USER" | echo " 🔃" > /tmp/imapsyncicon_"$USER" | ||||
pkill -RTMIN+12 i3blocks >/dev/null 2>&1 | pkill -RTMIN+12 i3blocks >/dev/null 2>&1 | ||||
# Parallelize multiple accounts | # Parallelize multiple accounts | ||||
for account in $accounts | |||||
for mwaccount in $mwaccounts | |||||
do | do | ||||
syncandnotify & | syncandnotify & | ||||
done | done | ||||
@@ -75,4 +77,4 @@ pkill -RTMIN+12 i3blocks >/dev/null 2>&1 | |||||
notmuch new 2>/dev/null | notmuch new 2>/dev/null | ||||
#Create a touch file that indicates the time of the last run of mailsync | #Create a touch file that indicates the time of the last run of mailsync | ||||
touch "$lastrun" | |||||
touch "$mwlastrun" |
@@ -43,9 +43,8 @@ mbsyncbin="$prefix/bin/mbsync -c $mwmbsyncrc" | |||||
msmtpbin="$prefix/bin/msmtp" | msmtpbin="$prefix/bin/msmtp" | ||||
_mwaddrmwtype(){ | _mwaddrmwtype(){ | ||||
mwacc="$mwaddr" # let the user always just deal with his email | mwacc="$mwaddr" # let the user always just deal with his email | ||||
mwaccmutt="${mwaddr//[.@]/_}" # but mutt would not show it with an @ or . | |||||
mwaccmaildir="$mwmaildir/$mwacc" # mail dir is $MAILDIR/email | |||||
mwacccachedir=$mwcachedir/${mwaddr//[.@]/_} # @ cannot stay because of mutt, . could | mwacccachedir=$mwcachedir/${mwaddr//[.@]/_} # @ cannot stay because of mutt, . could | ||||
mwaccmaildir="$mwmaildir/$mwaccmutt" # folder name as shown by mutt and opens with gf in vim | |||||
mwaccmuttrc="$mwaccmuttdir/$mwidnum-$mwacc.mwonofftype.$mwtype.muttrc" | mwaccmuttrc="$mwaccmuttdir/$mwidnum-$mwacc.mwonofftype.$mwtype.muttrc" | ||||
mwpass=mutt-wizard-$mwaddr | mwpass=mutt-wizard-$mwaddr | ||||
[ -n "$mwidnum" ] && mwaccmuttrc="$mwaccmuttdir/$mwidnum-$mwacc.mwonofftype.$mwtype.muttrc" | [ -n "$mwidnum" ] && mwaccmuttrc="$mwaccmuttdir/$mwidnum-$mwacc.mwonofftype.$mwtype.muttrc" | ||||
@@ -46,7 +46,8 @@ If the user chooses to keep offline email with | |||||
it will be kept in | it will be kept in | ||||
.I $MAILDIR | .I $MAILDIR | ||||
which defaults to | which defaults to | ||||
.I $HOME/mail/. | |||||
.I $HOME/Mail/ | |||||
, the default for mutt. | |||||
.B notmuch | .B notmuch | ||||
can be used to index and search this mail by giving this directory when first running | can be used to index and search this mail by giving this directory when first running | ||||
.B notmuch setup. | .B notmuch setup. | ||||
@@ -55,7 +56,7 @@ If you have not set up notmuch before, mutt-wizard will automatically set it up | |||||
.B muttrc files | .B muttrc files | ||||
mutt-wizard will create a muttrc file for each created account holding account-specific details. These will appear in | mutt-wizard will create a muttrc file for each created account holding account-specific details. These will appear in | ||||
.I $XDG_CONFIG_HOME/mutt/accounts/. | .I $XDG_CONFIG_HOME/mutt/accounts/. | ||||
$XGD_CONFIG_HOME default to ~/.config. | |||||
$XGD_CONFIG_HOME defaults to ~/.config. | |||||
Note that mutt-wizard will also source these files and create the bindings to switch between them, and these will appear in your default | Note that mutt-wizard will also source these files and create the bindings to switch between them, and these will appear in your default | ||||
.I $XDG_CONFIG_HOME/mutt/muttrc | .I $XDG_CONFIG_HOME/mutt/muttrc | ||||
file. | file. | ||||
@@ -141,9 +142,9 @@ While mail is open, go to next or previous mail with | |||||
and | and | ||||
.I K. | .I K. | ||||
In the mail index, | In the mail index, | ||||
.I d | |||||
.I ctrl-d | |||||
and | and | ||||
.I u | |||||
.I ctrl-u | |||||
go down and up by a half page and | go down and up by a half page and | ||||
.I gg | .I gg | ||||
and | and | ||||
@@ -154,12 +155,12 @@ go to the very top and very bottom. | |||||
If you have | If you have | ||||
.B notmuch | .B notmuch | ||||
configured with your proper mail directory (see above), you may run | configured with your proper mail directory (see above), you may run | ||||
.I ctrl-f | |||||
.I S | |||||
to search for mail containing any given sequence. | to search for mail containing any given sequence. | ||||
Even without notmuch, | Even without notmuch, | ||||
.I L | |||||
.I gl | |||||
limits mail, showing only those with the given sequence in the subject while | limits mail, showing only those with the given sequence in the subject while | ||||
.I A | |||||
.I gL | |||||
shows all mail (same as limiting to "all"). | shows all mail (same as limiting to "all"). | ||||
.TP | .TP | ||||
.B Deleting mail | .B Deleting mail | ||||
@@ -167,7 +168,7 @@ shows all mail (same as limiting to "all"). | |||||
deletes mail, while | deletes mail, while | ||||
.I U | .I U | ||||
undeletes it (type in mail number to get to deleted mail). Note that | undeletes it (type in mail number to get to deleted mail). Note that | ||||
.I S | |||||
.I $ | |||||
saves your mailbox, finalizing deletion. If you have a | saves your mailbox, finalizing deletion. If you have a | ||||
.I Trash | .I Trash | ||||
box, deleted mail is moved there. If you want it to skip that and simply be deleted, comment out or remove the | box, deleted mail is moved there. If you want it to skip that and simply be deleted, comment out or remove the | ||||
@@ -179,7 +180,7 @@ line in that account's muttrc. | |||||
creates a new mail message; | creates a new mail message; | ||||
.I r | .I r | ||||
replies to the selected message; | replies to the selected message; | ||||
.I R | |||||
.I gr | |||||
replies all to the selected message and | replies all to the selected message and | ||||
.I f | .I f | ||||
fowards the selected message. | fowards the selected message. | ||||
@@ -197,27 +198,26 @@ to send the mail. | |||||
.TP | .TP | ||||
.B Saving and autocompleting email addresses with abook | .B Saving and autocompleting email addresses with abook | ||||
Install the optional dependency abook and you will be able to save the sender's email address with | Install the optional dependency abook and you will be able to save the sender's email address with | ||||
.I a. | |||||
.I ga. | |||||
Once this is done, when you are typing in any email/contact prompt, you may press | Once this is done, when you are typing in any email/contact prompt, you may press | ||||
.I Tab | .I Tab | ||||
to find contacts matching your input. Although abook is often used with mutt, it is also a useful program in its own right. | to find contacts matching your input. Although abook is often used with mutt, it is also a useful program in its own right. | ||||
.TP | .TP | ||||
.B Switching and moving mail between mailboxes | .B Switching and moving mail between mailboxes | ||||
The | The | ||||
.I g | |||||
key can be paired with several other keys to automatically move to another mailbox: gi: Inbox; gs: Sent; gd: Drafts; ga: Archive; gS: Spam; gj: Junk; gt: Trash. These bindings will only be present for accounts that have the boxes in question. Instead of | |||||
.I g, | |||||
you can also press | |||||
.I C | |||||
to copy mail or | |||||
.I M | |||||
to move mail to the same boxes. | |||||
.I i | |||||
key is paired with the two inital letters of a mailbox, isp: go to spam, ... | |||||
Similar | |||||
.I Cxy | |||||
will copy mail and | |||||
.I Mxy | |||||
will move mail to the according boxe. | |||||
.TP | .TP | ||||
.B Switching between accounts | .B Switching between accounts | ||||
mutt-wizard can configure as many as nine accounts each numbered by the lowest available number when configured. Press | mutt-wizard can configure as many as nine accounts each numbered by the lowest available number when configured. Press | ||||
.I i | .I i | ||||
followed by an account's number to change to that account: i2, i5, etc. | followed by an account's number to change to that account: i2, i5, etc. | ||||
.I ctrl-b | |||||
.I gu | |||||
to open a menu to select a url you want to open in you browser. | to open a menu to select a url you want to open in you browser. | ||||
.TP | .TP | ||||
.B Sidebar | .B Sidebar | ||||
@@ -226,7 +226,17 @@ mutt-wizard enables the sidebar by default which displays your account's boxes w | |||||
will toggle the sidebar. Move up and down in it with | will toggle the sidebar. Move up and down in it with | ||||
.I ctrl-k/j. | .I ctrl-k/j. | ||||
Open a box with | Open a box with | ||||
.I ctrl-o. | |||||
.I ctrl-o | |||||
or | |||||
.I ctrl-l | |||||
.TP | |||||
.B Input field / command line | |||||
.I ctrl-u | |||||
within input field / command line, will clear it | |||||
.I ctrl-a / ctl-e | |||||
go to beginning or end. | |||||
.I ctrl-g | |||||
aborts. | |||||
.TP | .TP | ||||
.B More information | .B More information | ||||
Remember that you can press | Remember that you can press | ||||
@@ -1,8 +1,15 @@ | |||||
# vim: filetype=neomuttrc | # vim: filetype=neomuttrc | ||||
# This file contains all of mutt-wizard's default settings. | |||||
# | |||||
# This file contains all of mutt-wizard's defaults. | |||||
# mutt-wizard will have this file sourced from your muttrc. | # mutt-wizard will have this file sourced from your muttrc. | ||||
# The vim-like key binding has been established by comparing different dotfiles. | |||||
# You can change bindings after the sourcing of the defaults. | |||||
# Or you can keep mutt-wizard from sourcing its defaults with this comment in your muttrc: | |||||
# #source /usr/share/mutt-wizard/mutt-wizard.muttrc | |||||
# | |||||
# In the interest of seamless updating, do not edit this file. | # In the interest of seamless updating, do not edit this file. | ||||
# If you want to override any settings, set those in your muttrc. | |||||
# ==================== SETTINGS ==================== # | |||||
set mailcap_path = /usr/share/mutt-wizard/mailcap | set mailcap_path = /usr/share/mutt-wizard/mailcap | ||||
set date_format="%y/%m/%d %I:%M%p" | set date_format="%y/%m/%d %I:%M%p" | ||||
set index_format="%2C %zs %?X?A& ? %D %-15.15F %s (%-4.4c)" | set index_format="%2C %zs %?X?A& ? %D %-15.15F %s (%-4.4c)" | ||||
@@ -10,64 +17,21 @@ set sort = 'reverse-date' | |||||
set smtp_authenticators = 'gssapi:login' | set smtp_authenticators = 'gssapi:login' | ||||
set query_command = "abook --mutt-query '%s'" | set query_command = "abook --mutt-query '%s'" | ||||
set rfc2047_parameters = yes | set rfc2047_parameters = yes | ||||
set sleep_time = 0 # Pause 0 seconds for informational messages | |||||
set markers = no # Disables the `+` displayed at line wraps | |||||
set mark_old = no # Unread mail stay unread until read | |||||
set mime_forward = yes # attachments are forwarded with mail | |||||
set wait_key = no # mutt won't ask "press key to continue" | |||||
set fast_reply # skip to compose when replying | |||||
set fcc_attach # save attachments with the body | |||||
set forward_format = "Fwd: %s" # format of subject when forwarding | |||||
set forward_quote # include message in forwards | |||||
set reverse_name # reply as whomever it was to | |||||
set include # include message in replies | |||||
set mail_check=60 # to avoid lags using IMAP with some email providers (yahoo for example) | |||||
auto_view text/html # automatically show html (mailcap uses w3m) | |||||
set sleep_time = 0 # Pause 0 seconds for informational messages | |||||
set markers = no # Disables the `+` displayed at line wraps | |||||
set mark_old = no # Unread mail stay unread until read | |||||
set mime_forward = yes # attachments are forwarded with mail | |||||
set wait_key = no # mutt won't ask "press key to continue" | |||||
set fast_reply # skip to compose when replying | |||||
set fcc_attach # save attachments with the body | |||||
set forward_format = "Fwd: %s" # format of subject when forwarding | |||||
set forward_quote # include message in forwards | |||||
set reverse_name # reply as whomever it was to | |||||
set include # include message in replies | |||||
set mail_check=60 # to avoid lags using IMAP with some email providers (yahoo for example) | |||||
auto_view text/html # automatically show html (mailcap uses w3m) | |||||
auto_view application/pgp-encrypted | auto_view application/pgp-encrypted | ||||
alternative_order text/plain text/enriched text/html | alternative_order text/plain text/enriched text/html | ||||
bind index,pager i noop | |||||
bind index,pager g noop | |||||
bind index,pager M noop | |||||
bind index,pager C noop | |||||
bind index \Cf noop | |||||
# General rebindings | |||||
bind attach <return> view-mailcap | |||||
bind attach l view-mailcap | |||||
bind editor <space> noop | |||||
bind pager,attach h exit | |||||
bind pager j next-line | |||||
bind pager k previous-line | |||||
bind pager l view-attachments | |||||
bind index gg first-entry | |||||
bind index G last-entry | |||||
bind index D delete-message | |||||
bind index U undelete-message | |||||
bind index L limit | |||||
bind index h noop | |||||
bind index l display-message | |||||
#bind browser h goto-parent | |||||
macro browser h '<change-dir><kill-line>..<enter>' "Go to parent folder" | |||||
bind index,pager H view-raw-message | |||||
bind browser l select-entry | |||||
bind pager,browser gg top-page | |||||
bind pager,browser G bottom-page | |||||
bind index,pager,browser d half-down | |||||
bind index,pager,browser u half-up | |||||
bind index,pager S sync-mailbox | |||||
bind index,pager R group-reply | |||||
bind index \031 previous-undeleted # Mouse wheel | |||||
bind index \005 next-undeleted # Mouse wheel | |||||
bind pager \031 previous-line # Mouse wheel | |||||
bind pager \005 next-line # Mouse wheel | |||||
bind editor <Tab> complete-query | |||||
macro index,pager a "|abook --add-email\n" 'add sender to abook' | |||||
macro index \Cr "T~U<enter><tag-prefix><clear-flag>N<untag-pattern>.<enter>" "mark all messages as read" | |||||
macro index \Cf "<enter-command>unset wait_key<enter><shell-escape>read -p 'Enter a search term to find with notmuch: ' x; echo \$x >\${XDG_CACHE_HOME:-~/.cache}/mutt_terms<enter><limit>~i \"\`notmuch search --output=messages \$(cat \${XDG_CACHE_HOME:-~/.cache}/mutt_terms) | head -n 600 | perl -le '@a=<>;s/\^id:// for@a;$,=\"|\";print@a' | perl -le '@a=<>; chomp@a; s/\\+/\\\\+/ for@a;print@a' \`\"<enter>" "show only messages matching a notmuch pattern" | |||||
macro index A "<limit>all\n" "show all messages (undo limit)" | |||||
# Sidebar mappings | # Sidebar mappings | ||||
set sidebar_visible = yes | set sidebar_visible = yes | ||||
set sidebar_width = 20 | set sidebar_width = 20 | ||||
@@ -75,6 +39,62 @@ set sidebar_short_path = yes | |||||
set sidebar_next_new_wrap = yes | set sidebar_next_new_wrap = yes | ||||
set mail_check_stats | set mail_check_stats | ||||
set sidebar_format = '%B%?F? [%F]?%* %?N?%N/? %?S?%S?' | set sidebar_format = '%B%?F? [%F]?%* %?N?%N/? %?S?%S?' | ||||
# ==================== settings ==================== # | |||||
# =================== SHORTCUTS ==================== # | |||||
# Non-standard, more vim-like key mappings | |||||
# | |||||
# Free keys | |||||
bind index h noop | |||||
bind index,pager d noop #used for dX | |||||
bind index,pager i noop #used for goto iXY and i[1-9] in account muttrc (XY = 2 mailbox letters) | |||||
bind index,pager M noop #used for CXY, "move" to XY in account muttrc | |||||
bind index,pager C noop #used for CXY, "copy" to XY in account muttrc | |||||
bind pager,attach,browser,index g noop | |||||
# Moving between views the vim way | |||||
bind attach,index gg first-entry | |||||
bind attach,index G last-entry | |||||
bind pager,browser gg top-page | |||||
bind pager,browser G bottom-page | |||||
bind pager G bottom | |||||
bind pager k previous-line | |||||
bind pager j next-line | |||||
# l gets from index to mail to attachents to system view via mailcap | |||||
# h back vim-like (q by mutt) | |||||
bind index l display-message | |||||
bind browser l select-entry | |||||
bind pager l view-attachments | |||||
bind attach l view-mailcap | |||||
bind attach <return> view-mailcap | |||||
bind pager,attach h exit | |||||
macro browser h '<change-dir><kill-line>..<enter>' "Go to parent folder" | |||||
# Moving inside view as in vim | |||||
bind attach,index,pager,browser \Cd half-down | |||||
bind attach,index,pager,browser \Cu half-up | |||||
bind attach,browser,pager,index \Cf next-page | |||||
bind attach,browser,pager,index \Cb previous-page | |||||
bind browser,pager,index \Ce next-line | |||||
bind browser,pager,index \Cy previous-line | |||||
# and using mouse | |||||
bind index \031 previous-undeleted # Mouse wheel | |||||
bind index \005 next-undeleted # Mouse wheel | |||||
bind pager \031 previous-line # Mouse wheel | |||||
bind pager \005 next-line # Mouse wheel | |||||
# | |||||
# Using other dX and gX keys | |||||
bind index gl limit | |||||
macro index gL "<limit>all\n" "show all messages (undo limit)" | |||||
# 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 | |||||
bind index - collapse-thread | |||||
bind index _ collapse-all | |||||
# Sidebar (J/K goes to previou/next mail by mutt) | |||||
bind index,pager \Ck sidebar-prev | bind index,pager \Ck sidebar-prev | ||||
bind index,pager \Cj sidebar-next | bind index,pager \Cj sidebar-next | ||||
bind index,pager \Co sidebar-open | bind index,pager \Co sidebar-open | ||||
@@ -82,19 +102,37 @@ bind index,pager \Cl sidebar-open | |||||
bind index,pager \Cp sidebar-prev-new | bind index,pager \Cp sidebar-prev-new | ||||
bind index,pager \Cn sidebar-next-new | bind index,pager \Cn sidebar-next-new | ||||
bind index,pager B sidebar-toggle-visible | bind index,pager B sidebar-toggle-visible | ||||
# Edit the vim way | |||||
# D, U = delete/undelete by pattern by mutt | |||||
bind pager,index dd delete-message #u is undelete by mutt | |||||
bind index,pager gr group-reply #R is recall postponed by mutt | |||||
bind editor <space> noop | |||||
bind editor <Tab> complete-query | |||||
bind index,pager V view-raw-message | |||||
# Other | |||||
bind pager t display-toggle-weed | |||||
# | |||||
# Macros | |||||
macro index \Cr "<tag-pattern>~U<enter>\ | |||||
<tag-prefix><clear-flag>N<untag-pattern>.<enter>" \ | |||||
"mark all messages as read" | |||||
macro index,pager ga "|abook --add-email\n" 'add sender to abook' #"a" alone, add to alias | |||||
macro index S "<enter-command>unset wait_key<enter><shell-escape>read -p 'Enter a search term to find with notmuch: ' x; echo \$x >\${XDG_CACHE_HOME:-~/.cache}/mutt_terms<enter><limit>~i \"\`notmuch search --output=messages \$(cat \${XDG_CACHE_HOME:-~/.cache}/mutt_terms) | head -n 600 | perl -le '@a=<>;s/\^id:// for@a;$,=\"|\";print@a' | perl -le '@a=<>; chomp@a; s/\\+/\\\\+/ for@a;print@a' \`\"<enter>" \ | |||||
"show only messages matching a notmuch pattern" | |||||
macro pager gu "|urlscan<enter>" "call urlscan to open links" | |||||
# =================== shortcuts ==================== # | |||||
# Default index colors: | |||||
## ===================== COLOR ===================== # | |||||
# Default index colors | |||||
color index yellow default '.*' | color index yellow default '.*' | ||||
color index_author red default '.*' | color index_author red default '.*' | ||||
color index_number blue default | color index_number blue default | ||||
color index_subject cyan default '.*' | color index_subject cyan default '.*' | ||||
# New mail is boldened: | |||||
# New mail is boldened | |||||
color index brightyellow black "~N" | color index brightyellow black "~N" | ||||
color index_author brightred black "~N" | color index_author brightred black "~N" | ||||
color index_subject brightcyan black "~N" | color index_subject brightcyan black "~N" | ||||
# Other colors and aesthetic settings: | |||||
# Other colors and aesthetic settings | |||||
mono bold bold | mono bold bold | ||||
mono underline underline | mono underline underline | ||||
mono indicator reverse | mono indicator reverse | ||||
@@ -124,8 +162,7 @@ color signature brightgreen default | |||||
color bold black default | color bold black default | ||||
color underline black default | color underline black default | ||||
color normal default default | color normal default default | ||||
# Regex highlighting: | |||||
# Regex highlighting | |||||
color header blue default ".*" | color header blue default ".*" | ||||
color header brightmagenta default "^(From)" | color header brightmagenta default "^(From)" | ||||
color header brightcyan default "^(Subject)" | color header brightcyan default "^(Subject)" | ||||
@@ -149,3 +186,4 @@ color body brightyellow red "^gpg: BAD signature from.*" | |||||
mono body bold "^gpg: Good signature" | mono body bold "^gpg: Good signature" | ||||
mono body bold "^gpg: BAD signature from.*" | 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<>\"]" | 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<>\"]" | ||||
## ===================== color ===================== # |
@@ -15,7 +15,6 @@ run_only_test() { | |||||
#these are called for every test | #these are called for every test | ||||
setup() | setup() | ||||
{ | { | ||||
run_only_test 6 | |||||
rm -rf mwtesttmp | rm -rf mwtesttmp | ||||
XDG_CONFIG_HOME=mwtesttmp/config \ | XDG_CONFIG_HOME=mwtesttmp/config \ | ||||
MAILDIR=mwtesttmp/share/mail \ | MAILDIR=mwtesttmp/share/mail \ | ||||