Sep
28
2012
Vim English-Greek Spell Dictionary

I use vim as my primary editor.


btw i've never believed in Vim Vs Emacs cause the are two very different 
programs that do very different staffs with very different ways.

Apples and Orange.

The only (by me) common thing is that you can use them as editors too.

I use mutt as my primary MUA with $EDITOR=vim.

Writing frequently emails in more than one language can be harsh with no key bindings or a spell checker. You have to be very careful cause a tiny typo error can confuse a lot of people or worse.

People in sysadmin jobs understand what i mean a little better than others.

vim has been integrated with spell checking functionality. English (of course) are embedded.

To read all about that, open vim and on command mode write:


: help spell

If you want globally to map a function key to English spell checking functionality then, in /etc/vimrc write something like that:


:map <f5> :setlocal spell spelllang=en_us<return>

Next time you open vim (or editing an email through mutt) you can press F5 to spell check your text/email.

 

For Greek spell you need to google it. If you do that, then you’ll find instructions of using openoffice greek spell zip file for creating yours vim spell file (hint: mkspell). You can map it with F6 key and use it as above.

But I am writing both English & Greek and i am boring of typing F[what ever] key or switching languages and mpla mpla mpla mpla …

I use english_greek_spelling_dictionary of Firefox.

So how cool should be if a similar spell checking mechanism exist for vim ? A few days ago, linuxinside.gr had a tribute on pkst (Κώστας Παπαδήμας) and the idea strike me at that moment.

Here are the instructions of making your own



wget -c https://addons.mozilla.org/firefox/downloads/file/108368/english_greek_spelling_dictionary-0.5.5-tb+fx+sm.xpi
unzip english_greek_spelling_dictionary-0.5.5-tb+fx+sm.xpi
cd dictionaries/

At this point we will use mkspell.
Open vim:


vim

and on command mode type:


:mkspell engr English & Greek

The result is something like this:


Reading affix file English & Greek.aff ...
Trailing text in English & Greek.aff line 532: υ
Affix name too long in English & Greek.aff line 871: AA
Reading dictionary file English & Greek.dic ...
First duplicate word in English & Greek.dic line 588565: ΑΒΑ
12794 duplicate word(s) in English & Greek.dic
Compressing word tree...
Compressed 12575870 of 13454281 nodes; 878411 (6%) remaining
Compressed 15867 of 20446 nodes; 4579 (22%) remaining
Writing spell file engr.utf-8.spl ...
Done!
Estimated runtime memory use: 4415720 bytes

If you try to use a region name, then you will be facing the below error msg:


:mkspell en_gr English & Greek

E751: Output file name must not have region name

The result is : engr.utf-8.spl

We can move this to vim default spell location:


sudo cp engr.utf-8.spl /usr/share/vim/vim73/spell/

To map a key to English-Greek spell dictionary, open /etc/vimrc and add the below line:


:map <f6> :setlocal spell spelllang=engr<return>

Here is an example:

vim.spell.png

and here is the file (if you dont want to make it)

engr.utf-8.spl

  1. Avatar di tsagi tsagi

    Saturday, January 11, 2014 - 13:35:00

    Hi!
    The thing is that it works ok for English words but when it comes to Greek characters it just ignores them.
    Take a look: http://cl.ly/image/0V0k413O0×1v