简体   繁体   中英

Spell check with CAPS using Sublime Text

I've noticed that Sublime Text 3 seems to ignore CAPITALISED words when using the spell checker.

Quite a lot of my document has strings in caps. I don't want to mess with the formatting, just check the spelling.

Is there a file I can modify to toggle spell check where capitals are involved in SublimeText3?

I realise this may get thrown out for not being a coding question but I'll show you a Venn diagram of those who use SO and those who know how to really use Sublime Text.

The answer is yes, you can spell-check words in all caps, but it's going to take some effort. There is a setting that is appropriate here:

// Word list to use for spell checking. May also be a list of dictionaries.
"dictionary": "Packages/Language - English/en_US.dic",

The included dictionaries (there is one for en_US and one for en_GB ) include some words in all caps, such as AIDS and DNA, but not all, so you'll need to make your own .dic file. Fortunately, this is fairly straightforward. You'll need to extract the original file, convert it to upper case in Sublime, save it, then change your settings to point to both dictionaries.

To extract the dictionary package, install PackageResourceViewer from Package Control. Open the Command Palette with Ctrl Shift P ( Shift P on macOS), type in prv , make sure PackageResourceViewer: Extract Package is selected, and hit Enter . Next, select the Language - English package, hit Enter , then hit Enter again when it shows Start Extraction (1 of XX items selected) . A little popup should come up telling you the package was extracted successfully.

Next, you'll need to navigate to the correct folder and open the dictionary file in Sublime. Select Preferences → Browse Packages… (macOS: :Sublime Text → Preferences → Browse Packages… ) to open the Packages directory in your file manager:

  • Linux: ~/.config/sublime-text-3/Packages or ~/.config/sublime-text/Packages
  • macOS/OS X: ~/Library/Application Support/Sublime Text 3/Packages or ~/Library/Application Support/Sublime Text/Packages
  • Windows Regular Install: C:\Users\ \AppData\Roaming\Sublime Text 3\Packages or C:\Users\ \AppData\Roaming\Sublime Text\Packages \AppData\Roaming\Sublime Text 3\Packages或C:\Users\ \AppData\Roaming\Sublime Text\Packages
  • Windows Portable Install: \Sublime Text 3\Data\Packages or \Sublime Text\Data\Packages \Sublime Text 3\Data\Packages或 \Sublime Text\Data\Packages

The exact path depends on version and whether or not you upgraded from Sublime Text 3.

Once in Packages , navigate into the Language - English directory and open either en_US.dic or en_GB.dic (depending on your locale and preference) in Sublime. Hit Ctrl A (macOS: A ) to Select All. Next, select Edit → Convert Case → Upper Case and all letters will be capitalized. Finally, select File → Save As… . Navigate up one level from Language - English to Packages , then go into the User directory and save the file there as en_US_CAPS.dic or en_GB_CAPS.dic , depending on which original you opened.

Finally, select Preferences → Settings and add the following to your user settings on the right side:

"dictionary": ["Packages/Language - English/en_US.dic", "Packages/User/en_US_CAPS.dic"],

Change both occurrences of US to GB if that's what you're using. Save, and you should be all set.


If you want to clean up a little at the end, you can delete the Packages/Language - English folder that was created earlier, but things should be just fine if you don't.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM