How to toggle line numbers with a keyboard command in Sublime Text 2?

sublimetext2

Solution

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

{ "keys": ["ctrl+shift+l"], "command": "toggle_setting", "args":
        {"setting": "line_numbers"} }

Don't forget to add a comma at the end of above code if you are placing anywhere but at the end of the Key Bindings Preferences file.

Problem

In Sublime Text 2, you can turn line numbers on and off using the `line_numbers` setting, but there isn't an equivalent `toggle_line_numbers` command you can bind to a keystroke (as there is for, say, `toggle_tabs` to toggle file tabs). So is there another way to configure it so I can toggle line numbers at a keystroke?

Original source