Spellcheck in Eclipse

Eclipse has support for doing spellcheck of words in code or comments.

  • The configuration is handled from Preferences -> General -> Editors -> Text Editors -> Spelling. (Note: This dialog has some display problem and renders a very long page. Scroll down slowly to be able to view all the items.)
  • In the Options, you can choose all the cases where spellcheck can be ignored.
  • In the Dictionaries section, you can choose the language dictionary to use (I use English (United States). You can also pick a text file to use when you add your own words to dictionary. (I like to point this to my Vim text spellfile.) You can also choose the Encoding (I pick UTF-8).
  • Misspelt words appear in the editor underlined with a red squiggle. Right-click to fix the misspelling or add the word to your dictionary.

Tried with: Eclipse 4.5 and Ubuntu 14.04

How to make spellfile in Vim

Vim can be used to perform a spellcheck of your document, as described here. Vim can maintain a spellfile for you where you can add your good words that are not in the dictionary used by Vim for spellcheck.

This spellfile by default is stored in the directory ~/.vim/spell and its filename is of the format lang.encoding.add. lang is what you set in the spelllang variable. encoding is what you set in the encoding variable. For example, on my system this file is named en.utf-8.add.

The spellfile described above is in plaintext format and has one word per line. You can back it up to version control, copy it to different computers and edit it yourself to add or remove words.

However, to actually use the spellfile for spellcheck, Vim needs to convert this to an optimal lookup data structure and store it as a binary file in the same directory with a .spl suffix. For example, on my system this is the file: ~/.vim/spell/en.utf-8.add.spl. The extremely confusing fact is that Vim refers to both types of these files as spellfile in its documentation!

Vim automatically builds the binary spellfile when you add a word to the dictionary. However, if you had copied the text spellfile from another computer, you may need to manually generate the binary spellfile once.

To make the .spl binary spellfile from the .add text spellfile, use the mkspell command:

:mkspell! ~/.vim/spell/en.utf-8.add

Tried with: Vim 7.4 and Ubuntu 14.04

How to spellcheck in Vim

Vim has built-in ability to perform spellcheck. The VimCasts video on spellcheck gives a good summary of these features.

  • Use the set spelllang option to set the language to be used for spellcheck. For example, to set International English, add this to your vimrc:
set spelllang=en
  • To perform a spellcheck use :set spell. The wrongly spelled words are marked in Vim.

  • ]s to jump to next misspelled word.

  • z= to see suggestions for misspelled word under cursor.

  • zg to add misspelled word under cursor to your personal spellfile. Remember it as adding a good word.

  • zG to ignore the misspelled word under cursor for this session.

  • zw to mark correctly spelled word under cursor as a misspelling. Remember it as adding a wrong word.

The spellfile can be found in ~/.vim/spell/. For example, mine is named en.utf-8.add

Tried with: Vim 7.4 and Ubuntu 14.04

LibreOffice Writer spellcheck not working

Problem

A document that has obvious spelling mistakes is opened in LibreOffice Writer. When spellcheck is performed, it reports that The spellcheck is complete and there are no spelling errors.

Solution

This problem seems to be something related to the language settings in LibreOffice. I was able to get it to perform a spellcheck correctly by explicitly changing the language in the document.

To do this, choose Tools > Language > For all text > English (USA). Writer immediately showed spelling errors with red squiggles and running spellcheck showed up these mistakes for correction.

If you want spellcheck done in some other language, then choose Tools > Language > For all test > More. In the Locale Setting dropdown, choose the language you want. It will now be added to the list shown in Tools > Languages > For all text. Choose it there for spellcheck in that language.

Tried with: LibreOffice Writer 3.5.7.2 and Ubuntu 12.04 LTS