Talk:Mutt

From ArchWiki
Latest comment: 24 March 2023 by Antonok in topic Neomutt

Maildir

set folder=$HOME/mail

Does the folder need a trailing slash? like

set folder=$HOME/mail/

Napterk (talk) 06:45, 4 April 2016 (UTC)Reply[reply]

Deleted section in Display recipient instead of sender in "Sent" folder view

This section was originally under `Display recipient instead of sender in "Sent" folder view`

I removed it because there's a much simpler way, but this might be useful for some edge cases, so feel free to put it back (with a caveat that it's sub-optimal). The deleted section follows.

—This unsigned comment is by Ostiensis (talk) 10:11, 27 September 2016‎. Please sign your posts with ~~~~!

Old content

The "columns" of the index can be configured through the index_format variable. Its syntax is documented in the muttrc man page. The values of our concern are %t (recipient) and %F (sender).

To change the columns according to the current folder, we need to use a hook:

muttrc
folder-hook   .*[sS]ent.* 'set index_format="%2C | %Z [%d] %-30.30t (%-4.4c) %?M?<%M> ?%s"'
folder-hook ! .*[sS]ent.* 'set index_format="%2C | %Z [%d] %-30.30F (%-4.4c) %?M?<%M> ?%s"'

The exclamation mark means everything that does not match the following regex. Of course you can change the index_format following your taste, and the regular expression if the folder does not have Sent nor sent in its name.

Let us centralize the settings, it will simplify future tweaking.

muttrc
set my_index_format_pre='set index_format="%2C | %Z [%d] %-30.30'
set my_index_format_post=' (%-4.4c) %?M?<%M> ?%s"'

folder-hook .*[sS]ent.* "$my_index_format_pre"t"$my_index_format_post"
folder-hook ! .*[sS]ent.* "$my_index_format_pre"F"$my_index_format_post"

Neomutt

As it stands neomutt is still a drop-in replacement for mutt, apart from the changed names and paths (mutt -> neomutt). However, as the projects continue to diverge, this may change and require a separate article (Neovim is similar). -- Alad (talk) 07:14, 26 October 2017 (UTC)Reply[reply]

Current content is too short for a dedicate page. So I think we can just leave it here for now. If it become longer latter, than move it to its own page. --Fengchao (talk) 10:03, 2 July 2018 (UTC)Reply[reply]
Neomutt version 20230322 removed the samples directory, so several parts of the documentation here no longer apply. For example, enabling GPG support - see this issue. --Antonok (talk) 19:43, 24 March 2023 (UTC)Reply[reply]

muttrc inconsistency

The filename used in the muttrc snippets (using Template:hc) is inconsistent. It is sometimes muttrc and sometimes .muttrc. Which one is right?

-- NetSysFire (talk) 00:26, 23 May 2021 (UTC)Reply[reply]

It is muttrc when in $XDG_CONFIG_HOME/mutt (or neomuttrc when in $XDG_CONFIG_HOME/neomutt for neomutt), but it is .muttrc when in the user home directory.

-- Inventor500 13:42, 25 October 2021 (UTC)

Better way to view HTML

The workaround to viewing HTML Mutt#Viewing HTML currently describes setting up a macro such that the HTML gets opened by $BROWSER when pressing V.

What is simpler is to have an executable file

~/.config/mutt/openfile
#!/bin/sh
# Helps open a file with xdg-open from mutt in a external program without weird side effects.
tempdir="${XDG_CACHE_HOME:-$HOME/.cache}/mutt-wizard/files"
file="$tempdir/${1##*/}"
mkdir -p "$tempdir"
cp -f "$1" "$file"
xdg-open "$file" >/dev/null 2>&1
find "${tempdir:?}" -mtime +1 -type f -delete

and set in your mailcap

~/.config/mutt/mailcap
text/html; ~/.config/mutt/openfile %s ; nametemplate=%s.html
image/*; ~/.config/mutt/openfile %s ;
application/pdf; ~/.config/mutt/openfile %s ;

which you of course reference in your muttrc

muttrc
set mailcap_path = $HOME/.config/mutt/mailcap:$mailcap_path
bind attach <return> view-mailcap

This way you can just press enter to open the html or any any pdf attachment.

—This unsigned comment is by BoostCookie (talk) 21:56, 22 November 2023. Please sign your posts with ~~~~!