Monolune

Writing French in Vim

When using Vim, I mostly write text in English, but the need to write in French made me curious about the things that can be done to make writing French easier. Overall, the experience of writing French is similar to what I was used to with English, except for spell checking and inserting characters that are not present in English (e.g. ç, à, œ, etc.).

Spell Checking

To enable spell checking for French words, add the following to your vimrc:

set spell
set spelllang+=fr

Notice the triple 'l' in 'spelllang'! The '+' sign is a precaution to not accidentally disable any spell checking that you may have previously enabled. The '+' sign adds French as a language instead of overwriting the existing list of languages. If vim does not have the required files to do spell checking for French, it will offer to download the required 'spellfiles' (word lists used for spellchecking).

Special Characters

If you are using a US QWERTY keyboard, you may not have the keys necessary to type out certain characters present in some French words (such as the cedilla, and accents). Thankfully, there is a way to enter special characters in Vim. :digraphs shows the list of special characters that can be entered. To actually enter one of those characters, you must first enter insert mode. Then, press <CTRL-k> and enter the combination. To illustrate, suppose you wish to enter a cedilla ('ç'). According to the left column shown in :digraphs, the combination for 'ç' is 'c,'. So to enter that character in Vim, enter insert mode, press <CTRL-k>, followed by 'c,'. There you go.

Here's a table of the common French characters you may wish to enter (remember to be in insert mode and to precede the key combination with <CTRL-k>):

CharacterKey combination
ée' (apostrophe)
èe! or e` (backtick)
êe>
ïi:
çc,
œoe

There are common themes that can be applied to other letters too (e.g. à). Accent aigu ends with a backtick (<code>&grave;</code>), accent grave ends with an exclamation mark (!), accent circonflexe ends with a greater than sign (>), accent tréma ends with a colon (:), etc.

Hope this helps! I am trying to streamline my writing experience when using Vim. Do you write French in Vim too? Is there anything I have missed?