Home Download Buy Blog Forum Support

Keybind for Convert to tabs to spaces and vice-versa

Keybind for Convert to tabs to spaces and vice-versa

Postby dsarch on Wed May 04, 2011 2:55 pm

Hi,

I did some research in the documentation and i did not found a way to map a keybind for convert tabs to space. Is there a way ? I looked at the commands reference, but i did not saw any command that does this.

Thanks for the help !
dsarch
 
Posts: 62
Joined: Tue May 03, 2011 2:31 am

Re: Keybind for Convert to tabs to spaces and vice-versa

Postby guillermooo on Wed May 04, 2011 3:23 pm

View > Indentation contains two similar commands:

Convert Indentation to Spaces
Convert Indentation to Tabs

If you then search Packages/Default/Main.sublime-menu, you will find the actual command names:

expand_tabs
unexpand_tabs

They might do what you want.
guillermooo
 
Posts: 718
Joined: Thu Jul 23, 2009 9:06 am

Re: Keybind for Convert to tabs to spaces and vice-versa

Postby dsarch on Wed May 04, 2011 3:25 pm

Thanks a lot, @guilhermoo !

It is exaclty what i was searching for.

Thanks again =)
dsarch
 
Posts: 62
Joined: Tue May 03, 2011 2:31 am

Re: Keybind for Convert to tabs to spaces and vice-versa

Postby pmorch on Thu Jun 06, 2013 7:19 pm

Also, if you run the command
Code: Select all
sublime.log_commands(True)
e.g. from the console, then you can see all commands executed in the console. Clicking "Convert Indentation to Spaces" from either the menu or from ctrl+shift+p will then print this in the console:
Code: Select all
command: expand_tabs {"set_translate_tabs": true}
Bingo!
pmorch
 
Posts: 1
Joined: Wed May 29, 2013 9:44 pm

Re: Keybind for Convert to tabs to spaces and vice-versa

Postby hubertusanton on Wed Jun 26, 2013 11:06 am

I added this to my shortcuts Default (Linux).sublime-keymap file, it works! Thanks for the tips.

Code: Select all
   { "keys": ["ctrl+shift+alt+~"], "command": "unexpand_tabs", "args" : {"set_translate_tabs" : true} }
hubertusanton
 
Posts: 1
Joined: Wed Jun 26, 2013 11:03 am


Return to Ideas and Feature Requests

Who is online

Users browsing this forum: No registered users and 9 guests

cron