DorkRawk
DorkRawk

Reputation: 770

Run A Console Script From a Sublime Text 2 Keybinding

I would like to run a single line console script to toggle spell_check in Sublime Text 2

view.settings().set('spell_check', True)

or

view.settings().set('spell_check', False)

via something like this:

{ "keys": ["ctrl+alt+s"], "command": "SOMETHING SIMILAR TO WHAT I HAVE ABOVE?" },

How do I enter this command into my keybindings file and how to I make it toggle?

Upvotes: 1

Views: 794

Answers (1)

fooOnYou
fooOnYou

Reputation: 698

As per http://www.sublimetext.com/docs/2/settings.html it looks like you should be able to do something like:

{
    "keys": ["ctrl+alt+s"],
    "command": "toggle_setting",
    "args":
    {
        "setting": "spell_check"
    }
}

Upvotes: 2

Related Questions