Episode: 1948
Title: HPR1948: Check Your Spelling in Vim
Source: https://hub.hackerpublicradio.org/ccdn.php?filename=/eps/hpr1948/hpr1948.mp3
Transcribed: 2025-10-18 11:41:48

---

This is HPR Episode 11948 entitled, check your spelling in Vim and in part of the series, Vimkins.
It is posted by Frank Mel and in about 12 minutes long, the summary is, Frank summarizes how to use spell check in Vim.
This episode of HPR is brought to you by an honesthost.com.
Get 15% discount on all shared hosting with the offer code, HPR15, that's HPR15.
Better web hosting that's honest and fair at An Honesthost.com.
Hello, this is Frank Bell.
Today I want to talk briefly about how you can check your spelling using Vim.
I'm going to take the approach that first we're just going to have a plain little text file.
You have it done any configuration whatsoever and you just want to check your spelling.
Then I'm going to go back and discuss some of the configuration options that you can put in your .them RC file to make the process a little easier.
Keep in mind that Vim does not observe any of what today we consider desktop conventions.
When Vim was written, when Vi was written and Vim is based on Vi, there were no desktop conventions.
None of this new fungal stuff existed.
Also, at that time, most network computing was done via dumb terminals connected to mainframes via 300 modems.
Every keystroke was money.
Hence, Vim's a very tourist command set.
If you could save a keystroke, you could save dollars.
Don't expect anything you do in Vim to look like something you might be doing in Cade or G-Edit or any of these fancy new fungal gooey things.
We'll start out with the basics.
You have a text file, you've typed up your show notes for your latest HPR podcast and you want to spell check in Vim.
The first step is to turn spelling on.
And the way you do this is to issue the spell command.
And you do it in this manner.
You hit escape, then calling to open up the command line at the bottom of the Vim window and type the command set spell.
See era, echo, time, go, space.
See era, papa, echo, Lima, Lima.
Essentially, all the words that Vim thinks are misspelled will be highlighted.
Your cursor will remain wherever it was at the time you issued the set spell command.
So how do you navigate to a misspelled word?
You use the square brackets and the SK.
Think of the brackets as blocky arrow keys.
The left grab bracket points to the left and up the file and the right one points to the right and down the file.
To navigate to the first misspelled word, above the cursor position, you would hit the left grab bracket and then lowercase s.
And the cursor will move to the word that Vim thinks is misspelled.
To choose the word, in other words, to open a word list, you type z, lowercase, z, equal.
And Vim will open a list of words and the words will be numbered from one to whatever.
To replace the existing word, you simply hit the number, or your choice, and then the energy.
So if you may have typed THIR, and you meant to type THIR, THIR will probably be the first word on the list.
You would hit the number one press center and Vim will change the word.
And you can tell you until you have corrected all the words that you wish to correct.
To turn off spelling, you can again, hit escape, calling, and issue the command set no spell.
Sierra, Echo, Tango, Space, November, Oscar, Sierra, Papa, Echo, Lima, Lima.
And the highlighting will go away and you'll be in command mode.
And then you can insert text or do whatever it is you need to do next to your file.
So that's the very basics.
You can make it a lot easier by creating a dot Vim RC file.
A long time ago, I read somewhere that RC stands for runtime configuration so that when you run a command,
at runtime, the RC file configures how that command is going to behave.
There are a number of things that you can put in your Vim RC file.
Mine was based initially on an excellent video done by Runx Voice as a companion to the tutorial on Vim
that they had in their first issue.
It could get about halfway through the video.
That's so long about the five minute mark they go into a discussion of Vim RC files.
And then I added some other things to my Vim RC file along the way as I tried to learn more about the Vim editor.
I have included my Vim RC file in the show notes.
Basically, in the Vim RC file, you put a series of commands that show how you want your Vim to behave when you invoke the program.
There are two that are relevant to spelling.
One of those is to set your spelling language.
And the syntax for that is Bell Rying S-P-E-L-L-A-N-G.
I won't bother to do the military out there.
Equals whatever your language is.
If you're not sure what your default language is, you can enter the locale command in a terminal and that will display that and a bunch of other information.
And my testing appears that if you do not have that Bell Rying line in your Vim RC, Vim simply defaults to your system default whatever that might happen to be.
Another thing you can do is configure Vim to save a personalized word list.
Say for example, in your text file you have the word podcast.
Vim doesn't recognize it. It wants to change it to potato chip or who knows what.
The solution to not being nagged by this is to create a spell file.
I have linked in the show notes to two sites.
One is a very good introduction and the other is the actual detailed spell check documentation from the Vim folks about how to do this.
The overview is you create a file to receive your personalized list of words.
They will not be added to the master list and slash usr share or wherever your distro puts in.
Unless of course your route you could probably take her with that.
So you create a file in your home directory to receive this.
And by convention that's done by creating a subdirect recall dot Vim.
And then in that another directory called spell and then in the spell directory you put your spell list.
And my Vim RC in the show notes if you look you will see that the command is set spell file equal and then the path there too.
The spell file itself is based on the encoding then we'll expect to see the encoding in the spell file but not the region.
So my encoding is in underscore us dot utfa.
My spell file is in dot utfa dot ATD at and I tell them in the Vim RC file that that's where I want it to put the added words.
And I have then added a number of words to that file.
Those include say podcast HBR is another word I've added.
And some others that I have used from time to time.
So that's the basic overview you need to configure your Vim RC to have to specify your spelling language spell line.
The work that you need to create a file to receive words you want to add to your word list and then in your dot Vim RC you tell them where to find the file.
Two things I've noticed while preparing this.
Why is that although all the references I read said to create a line for your spell line.
It doesn't seem absolutely necessary.
I remarked the spell line line out of my Vim RC file and I was still able to add a word to my word list.
My conclusion based on my little bit of playing around is that Vim if you don't set a spell line default to the system default whatever that might be.
However, I would include the spell line line in my Vim RC.
The other thing I noticed and this is said nothing whatsoever to do with spelling but it's really very neat.
Once you open the Vim command line you have escape colon to open the Vim command line at the bottom of the Vim window.
You can use your arrow keys just as if you were in a shell to navigate commands that you have previously issued.
You can go up up up up up and down down down down down.
That's something I didn't know before but when I was playing with this and it was changing my configuration on the fly with various set commands I found out a nice little revelation.
Again in the shell notes I would link to two excellent tutorials as well as to the two Linux voice items of the video and the Linux voice tutorial that I mentioned here.
I would urge you to learn more about Vim.
I will say when I was trying to learn how to do this I found the navigation part with the square brackets and the S very easy to remember.
The commands that I found were difficult to remember and had to look up a couple of times before they stopped where the Z commands.
The Z equal and the Z G.
I can see the G as the word get.
I have no idea where the Z came from.
Maybe zap the word and get another one or zap the word into your spell file.
Give it a shot. Once you get the hang of them you continually discover more and more things that you can do with the power that's hidden under that simple interface.
If you want to contact me my website is pineviewfarm.net and you can email me at Frank at pineviewfarm.net.
Thank you very much.
You've been listening to heckaPublicRadio at heckaPublicRadio.org.
We are a community podcast network that releases shows every weekday Monday through Friday.
Today's show, like all our shows, was contributed by an HPR listener like yourself.
If you ever thought of recording a podcast and click on our contributing to find out how easy it really is.
HeckaPublicRadio was founded by the digital dog pound and the infonomicon computer club and is part of the binary revolution at binwave.com.
If you have comments on today's show, please email the host directly, leave a comment on the website or record a follow-up episode yourself.
Unless otherwise status, today's show is released on the create of comments, attribution, share a light, 3.0 license.
Thank you very much.
