Sublime Forum

Spell check via keyboard possible?

#1

I’m trying to figure out whether it’s possible to spell check a document in Sublime without using the mouse.

There are bindings to turn spell checking on/off and to move between misspelled words, but none to trigger the “suggest correction / ignore” options which appear in the context menu when you right click on a misspelled word.

I looked through the Default package and the ST3 API and I’m mystified by how spell checking works. I can only find mentions to the three bindings I mentioned but none about how the “suggest correction / ignore” options work.

Ideally, I would like to be able to trigger a command when the cursor is on top (or has highlighted) a misspelled word that triggers something like the autocomplete menu. Using the mouse is very cumbersome, especially because I often write with the mouse partly disabled. (That’s a feature of one of my own packages.)

Can anyone tell me if this is possible and perhaps suggest where I should begin looking for implementing this?

Alex

0 Likes

#2

There doesn’t seem to be any related spell checking command in the Default/Context.sublime-menu file so I guess all spell checking stuff is hard-coded. Not much you can do in that case.

0 Likes

#3

Thanks for taking a look. I thought as much. I was merely hoping there was something I’d missed.

Alex

0 Likes

#4

Hey @quodlibet, I’m a bit late here, but I just moved from Vim and I had the same issue. I think I have a good work-around, though.

  1. Install KeyboardSpellCheck
  2. Install Enchant, e.g. brew install enchant. This is required per package control docs above.
  3. Disable google use for spellcheck. My experience was that you actually had to create the settings file (You should be able to copy/paste this):
echo '{ 
    "use_google": false,
    "mark_google": false
}' >> ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/User/KeyboardSpellCheck.sublime-settings;

4.If you don’t like the defaults, you can add your own bindings for moving between misspelled words, toggling spell check, and triggering possible replacements. I use my old Vim bindings here with comma as my hotkey:

  // Normal mode spell-check (Port of Vim mappings + KeyboardSpellCheck )

  // Toggle SpellCheck / Highlight misspellings 
  { "keys": [",", "z"], "command": "toggle_setting", "args": {"setting": "spell_check"}, "context": [{ "key": "setting.command_mode", "operand": true }, { "key": "setting.is_widget", "operand": false } ] },

  // Check Spelling
  { "keys": [",", "="], "command": "spell_check", "context": [{ "key": "setting.command_mode", "operand": true }, { "key": "setting.is_widget", "operand": false } ] },

  // Go to next misspelling
  { "keys": [",", "]"], "command": "next_misspelling" , "context": [{ "key": "setting.command_mode", "operand": true }, { "key": "setting.is_widget", "operand": false } ] }, 

  // Go to previous misspelling
  { "keys": [",", "["], "command": "prev_misspelling", "context": [{ "key": "setting.command_mode", "operand": true }, { "key": "setting.is_widget", "operand": false } ] },

If you have improvements to suggest, I’m all ears.

0 Likes

#5

Hey,

I am using Sublime Licenced and Paid version for very long time.

Keyboard shortcut that I am using for Spell check is F6.

https://i.imgur.com/my2dIJe.png

Let me know if this helps.

0 Likes