WeeChat is the IRC client I use to chat online. It has (nearly-)native support for aspell (a tool for spell checking), and I recently decided to enable it. But I could find no easy tutorial on the Internet to set it up; so here is mine!
1 Get aspell support
WeeChat is made of a set of core functions (in the
core module) and of a variety of plugins. Some of those plugins are mandatory and are always built in WeeChat: the
alias plugins for instance (respectively containing basic functions to use IRC or to declare command aliases). Other plugins include
python, or plugins with other language names (even
python plugin runs Python scripts). They are not needed for a basic IRC usage, and they are optional. One can see all available plugins at WeeChat launch, or list them simply by typing
/help inside WeeChat start buffer.
Aspell comes as one of those optional modules. It must be included into WeeChat software at compiling time. If you fetch the binaries from a package repository, you most probably have aspell support. But if you build WeeChat from the sources, be sure to link to aspell library. Under Debian, this should be automatic if you have installed the
libaspell-dev package prior to call
cmake for WeeChat compilation.
2 Obtain dictionaries
To use aspell, you need some dictionaries. The easiest way is to install it directly on the host with your package manager. For example under Debian, run
apt-get install aspell-en as root to obtain english dictionaries. It seems that dictionaries must be installed before launching a WeeChat session: I could not find a way to load dictionaries from an open session, other than quitting and launching it again. Maybe the
/upgrade command from WeeChat could do the trick without closing all connections, I have not tried it.
Once you have installed dictionaries you can launch WeeChat, but a few more steps are required to set up completely spell checking.
3 Use aspell
3.1 Enable aspell
Aspell seemed to be disabled by default on my session. If needed, enable it with:
Also, don’t forget to have look at the output of:
Aspell has several options, and I will not describe them all (read the docs). If you are not using the
iset Perl script already to manage your configuration inside WeeChat, I recommend you do so (and you can also use the
script plugin to open a buffer to manage script and install
iset from there).
3.2 Choose dictionaries
Important aspell options include the choice for the default dictionary. One can set it with
/set aspell.check.default_dict <language>
<language> should be replaced with e.g.
fr, depending on the language you want to use. Several dictionaries can be used at once.
If you want to use different languages on different buffers, here is a simple way to do it, based on this post:
- Declare a default dictionary;
- Change dictionary for all buffers where you wish to use a different language; a call to
/allchanmay be useful here. See post for details.
3.3 Display suggestions
Once running, aspell should highlight misspelled words inside your input bar (using the color defined in the
aspell.color.misspelled option). It can also display suggestions, but you have to enable it:
- Set the
aspell.check.suggestionsto some positive value (
- Add the
aspell_suggestelement to your layout. You could add it to your input bar or to your status bar for example:
/set weechat.bar.status.items "<whatever was there>,[aspell_suggest]".
Now you have aspell with error detection and suggests for suggestion. No more excuse to mistype words!
Without administrator privileges
libaspell-dev (for aspell support) or
aspell-en (to get dictionaries) with a packet manager obviously requires root privileges. I have not tried to build WeeChat with aspell support on a host without
libaspell-dev and where I could not install it, but my guess is that it is possible to download the library and to pass the path to
cmake before compiling.
I don’t know how to indicate the path to the dictionaries to use to WeeChat, though, or whether it is possible at all.