Add spell check to Nano

Jack Wallen
Dec 10, 2010
Updated • Jan 16, 2013
Linux
|
1

If you've been reading Ghacks long enough, you know my favorite console-based text editor is Nano. Nano is simple to use, efficient, and extensible. Nano can be used for many things: Writing, programming, editing configuration files, and more. Depending upon your needs, you might need to check the spelling of what you are writing or editing within Nano. Let's take a look at how you can add spell checking to this handy editor.

Out of the box, one thing that Nano is missing is spell checking. Nano does include the option for spell checking (you can even invoke spell checking from within Nano, but it won't work). Why is this? Simple - Nano makes use of a specific spell checker that is not installed on most distributions by default. So even though Nano has the keyboard shortcut available for spell checking, you have to make it work. Let's see how.

Installing the spell checker

Nano depends upon the package spell for spell checking. This is simple to install, from the command line, if you follow these steps:

  1. Open up a terminal window.
  2. Issue the command sudo apt-get install spell.
  3. Type your sudo password and hit Enter.
  4. Accept any dependencies (if necessary).
  5. Let the installation complete.

Once complete you are ready to use spell checking.

Check your spelling

Figure 1

Open up a document for editing within Nano. When you do this you should see the list of keyboard shortcuts along the bottom of the screen. Of those shortcuts the ^T shortcut should be listed. That will invoke spell checking.

With your document open hit Ctrl-t to begin the check. Figure 1 shows the Nano spell checking in action. Spell will begin at the top of your document and continue on until it comes across a word it does not recognize. When it lands on a mis-spelled (or unrecognizable) word it will stop and ask you to correct the spelling of the misspelled word. Spell will not offer suggestions for replacements. Instead Spell will simply allow you to edit the misspelled word. Once you've edited the word you will have the chance to change all instances of the misspelled word. To replace a single instance just retype the word and hit enter. You will be asked if you want to replace that instance. If you want to only replace that instance hit Y (for yes) or, if you want to replace all instances hit A (for all) and all instances of the misspelled word will be replaced. If you have misspelled your correction just hit Ctrl-c to cancel the replacement.

Once Nano is finished with the spell checking it will inform you by saying so. Since there is nothing automated or fancy about Nano you will need to remember to save your changes made to your document when you exit (using Ctrl-x) the editor.

Final thoughts

Most users have grown accustomed to auto-spell checks that make spelling suggestions to the users. That's not Nano. Nano wants you to think for yourself. It's not perfect, but it's as close to spell check as you will find with Nano.

Advertisement

Previous Post: «
Next Post: «

Comments

  1. keithpeter said on January 14, 2011 at 3:55 pm
    Reply

    If you use a language other than US English, you will need to

    1) Install the appropriate dictionary

    sudo apt-get install ibritish

    for UK English

    2) Set the default language for the spell program

    sudo select-default-ispell

    then use the up/down arrow to select the dictionary, and then tab to go to OK and then enter

    Thanks

Leave a Reply

Check the box to consent to your data being stored in line with the guidelines set out in our privacy policy

We love comments and welcome thoughtful and civilized discussion. Rudeness and personal attacks will not be tolerated. Please stay on-topic.
Please note that your comment may not appear immediately after you post it.