Ghopper21
Ghopper21

Reputation: 10477

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

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?

Upvotes: 16

Views: 9980

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 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.

Upvotes: 34

Related Questions