Monday, May 16, 2016

Learning how to type / spell (in weechat)

So I am REALLY not a good speller, and I spend a lot of time in front of a keyboard, and in applications that don't always have a good spell check mechanism. 

Lucky for me most do, and they are enabled by default. However some are not, and this makes me sad.

With that said, I took some time today to help remedy this issue, at least for my IRC client. As most of you know I moved to weechat some time ago, see http://sferich888.blogspot.com/2015/04/weechat-for-xchat-refugees.html for the basics of my configuration, and as such spell checking is not something weechat does by default.

This is because spelling is HARD, even for computers and applications. So weechat offloads the work to something that is good at it, aspell. As such you need to make sure your OS has the needed aspell dependencies installed, in order for this to work.

On my system this means:

# yum install aspell aspell-en
  OR
# dnf install aspell aspell-en
  • Note: This also installs the dictionaries that I use as an English speaker. 
From here all you need to do is start weechat and make a few configuration changes.  First of which is starting the built in integration component, and defining what language you want to use.
/aspell enable
### Example: /set aspell.check.default_dict <language>
/set aspell.check.default_dict en
With the Language and feature enabled, you should see spelling error get highlighted (in red), in your "input" bar.  You can change the color by setting aspell.color.misspelled to be a different value.

Its great an all, that the editor now shows me I have made a mistake, however it would be nice/better if it suggested, how to correct the mistake. For this you need to do 2 things. First enable the spelling suggestions in your "status" bar.
### Example: /set weechat.bar.status.items "<whatever was there>,[aspell_suggest]".
/set weechat.bar.status.items [time],buffer_number+: +buffer_name,[lag],completion,scroll,[aspell_suggest]
Next is to define how many suggestions you would like to see
/ set aspell.check.suggestions 3
Once this is complete, you should see, not only spelling errors, but suggestions (3 of them) in your status bar, show up so that you can correct them.

Be sure to save your configuration, or you might be forced to re-implement this every time you start weechat.  
/save