Skip Navigation

Text editing

Mutt doesn't edit text

When you reply-to or start a new email, mutt creates a temporary file, fills it with quoted-text and/or your signature, and opens it in an external text editor for you to compose your message. When you have finished, you save the message and mutt takes it from there.

It is up to you and your editor what the message contains. In particular mutt will not stop you from overquoting, bad-spelling or typing in lines that are just too long. You may need to read a guide for message editing and quoting or A Beginner's Guide to Effective Email.

Mutt uses an external editor if it can, this is most likely to be the traditional unix vi editor. Mutt looks to see whether you have an editor configuration setting, if not then it uses your $EDITOR environmental variable. If neither of these is set, then mutt uses the built-in line-oriented text editor.

You can check to see what your default editor is, by typing this in your shell:

echo $EDITOR

Vim

Vim is an improved clone of the standard vi editor and is installed as standard on many systems. Some reasons for using the vim text editor for email:

  • Syntax highlighting. vim will colour quoted text and signatures.
  • vi and mutt have very similar command and configuration interfaces.
  • Small footprint and ubiquity, there is some kind of version of vi on every unix or unix-like operating system.

If you are unfamiliar with the vi interface used with vim, then there is a handy tutorial that takes you through all the basic commands you will need, type this in your shell to start it:

vimtutor

If you need more, try working through a longer online Vim tutorial. Vim is "charity-ware", this means you can use and distribute it freely, but are encouraged to make a donation to the ICCF charity for orphans in Uganda.

Other editors

There are other text editors, if you don't know what they are, then you should probably stick with vim.

Spell checking

By default, mutt will use the Ispell spell-checker - if it is installed on your system. This is bound to i in the compose menu that appears after editing/creating your message.

Unfortunately, ispell doesn't distinguish between the stuff that needs to be checked for spelling and stuff that doesn't; Like attribution-lines, quoted text and sig files. Spellutils are a set of tools that can be used to ignore this junk when checking email with ispell and mutt.

An alternative to ispell is to use the more modern Aspell spell-checker. This mutt configuration command will switch your default to aspell, which can correctly identify the different parts of email:

set ispell="aspell -e -c"

You may prefer to check your spelling in your editor rather than your mailer. The following vim macro can be used to check email using aspell. Add it to your ~/.vimrc file and hit the f8 key in vim command mode to check your email text.

:autocmd FileType mail :nmap <F8> :w<CR>:!aspell -e -c %<CR>:e<CR>

Other methods of checking spelling in vim are: Vimspell, a set of macros that integrate ispell into vim, and engspchk which has the advantage of not requiring an external program such as ispell or aspell. With both these tools, misspelled words are highlighted in-place and alternatives are offered - However, neither have the email specific features of aspell or Spellutils.

<< | Up | >>

This document was last modified on 2012-02-28 21:31:15.
Bruno Postle <bruno@postle.net>
Copyright © 2001 Bruno Postle and others. This guide is released under the Free Documentation License. http://www.gnu.org/licenses/fdl.txt