Home Download Buy Blog Forum Support

How to set Tab size with keyboard shortcut?

How to set Tab size with keyboard shortcut?

Postby MrMartineau on Tue Dec 11, 2012 2:44 pm

I would like to setup keyboard shortcuts so I can quickly change tab sizes. After using
Code: Select all
sublime.log_commands(True)

I can see that when I change tab sizes, Sublime runs this:
Code: Select all
{"setting": "tab_size", "value": 2}

so I tried adding this to my keymap file, which does not work..
Code: Select all
   { "keys": ["super+ctrl+1"], "setting": "tab_size", "value": 1},
   { "keys": ["super+ctrl+2"], "setting": "tab_size", "value": 2},
   { "keys": ["super+ctrl+3"], "setting": "tab_size", "value": 3},
   { "keys": ["super+ctrl+4"], "setting": "tab_size", "value": 4}

Does anyone know how to do achieve what I need?
@MrMartineau || Setup Sublime Text quickly: Find out all you need at https://github.com/mrmartineau/SublimeTextSetup
MrMartineau
 
Posts: 78
Joined: Thu Jul 28, 2011 8:35 am

Re: How to set Tab size with keyboard shortcut?

Postby MrMartineau on Tue Dec 11, 2012 3:05 pm

After a bit of tinkering & investigation, I figured it out:
Code: Select all
   { "keys": ["super+ctrl+1"], "command": "set_setting", "args": {"setting": "tab_size", "value": 1} },
   { "keys": ["super+ctrl+2"], "command": "set_setting", "args": {"setting": "tab_size", "value": 2} },
   { "keys": ["super+ctrl+3"], "command": "set_setting", "args": {"setting": "tab_size", "value": 3} },
   { "keys": ["super+ctrl+4"], "command": "set_setting", "args": {"setting": "tab_size", "value": 4} }
@MrMartineau || Setup Sublime Text quickly: Find out all you need at https://github.com/mrmartineau/SublimeTextSetup
MrMartineau
 
Posts: 78
Joined: Thu Jul 28, 2011 8:35 am


Return to General Discussion

Who is online

Users browsing this forum: Exabot [Bot], Google [Bot], Yahoo [Bot] and 13 guests