Typo
[linux_from_scratch_hints.git] / OLD / mutt+aspell.txt
blobbaee145ec407d758ed61bebe4d35d633d07367a6
1 TITLE:          Using Aspell in Mutt
2 LFS VERSION:    All
3 AUTHOR:         Archaic <archaic@remove-this.indy.rr.com>
5 SYNOPSIS:
6         Multiple ways of setting up Mutt and/or Vim to use Aspell.
8 HINT:
9         This hint will be split into two parts. The first part will be
10 configuring Vim to spell check, the other will be for Mutt alone.
12 You do not need to do both, but it won't hurt if you do. You will just
13 have many different ways of spell-checking.
15 1) Setting up Vim to use Aspell.
17 Install aspell as per the BLFS book:
18 http://beyond.linuxfromscratch.org/view/cvs/general/aspell.html
20 edit your vimrc to include:
22 map ^T :w!<CR>:!aspell check %<CR>:e! %<CR>
24 NOTE: ^T is <ctrl-t>, but in Vim you have to type <ctrl-v> to type
25 control characters. Thus you need to replace ^T with <ctrl-v><ctrl-t>
27 Once you save your vimrc, any time you are in Vim's command mode, typing
28 <ctrl-t> will cause the screen to split showing the aspell commands at
29 the bottom.
31 If you use Vim as your editor in Mutt, you're all set to spell-check.
33 But wait! There's more!
35 If you are replying to an email and you hit <ctrl-t> aspell will attempt
36 to spell-check the headers, signature, and all the quoted lines in
37 addition to what you actually wrote. There is a nifty little app called
38 newsbody that will allow us to copy just the body of the message to a
39 temporary file, edit it (spell-check it), then put it back into the
40 original message, leaving headers and sigs alone. It also allows us to
41 ignore quoted lines.
43 You can get newsbody in a package called spellutils (current version is
44 4.7) here:
45 http://home.worldonline.dk/byrial/spellutils/spellutils-0.7.tar.bz2
47 ./configure &&
48 make &&
49 install -m755 newsbody /usr/bin
50 install -m644 newsbody.1 /usr/share/man/man1
52 NOTE: spellutils also builds a file pospell if you're interested in
53 spell-checking .po files.
55 Now that newsbody is installed add the following lines to your vimrc:
56 map ^R \1\2<CR>:e! %<CR>
57 map \1 :w!<CR>
58 map \2 :!newsbody -qs -n % -p aspell check \%f<CR>
60 These lines simply let you run aspell without having to check the sig,
61 headers, or quoted text. Treat ^R the same as ^T above. You can also
62 change the letter to suit your needs.
64 Now you have a way to spell-check regular documents and emails with
65 either <ctrl-t> or <ctrl-r>. You can stop here, or optionally continue
66 on. There is no added functionality below. Just a different way of doing
67 the same thing.
69 2) Setting up Mutt to use Aspell
71 NOTE: I use Vim in mutt but the following should work on your editor of
72 choice as these are mutt-specific, not editor-specific.
74 The default command to spell-check in Mutt is "i". There are 2 ways in
75 which to invoke newsbody and aspell in mutt. We can either call a simple
76 script, or we can write a macro. I will discuss both.
78 Script method:
80 cat >/usr/bin/spellcheck <<"EOF"
81 newsbody -hqs -n $2 -p aspell check %f
82 EOF
83 chmod 755 /usr/bin/spellcheck
85 add the following to your muttrc:
87 set ispell="/usr/bin/spellcheck"
89 -or-
91 Macro method:
93 add the following to your muttrc:
95 macro compose i \
96         "<filter-entry>newsbody -hqs -n - -p aspell check %f<enter>" \
97         "run aspell on the selected part"
99 I hope you've found this useful. Please email any suggestions or
100 corrections to the above address. Remove the "remvoe-this." from my
101 address.