What is the option in the Key Bindings file that I would use to set up a keyboard shortcut for the menu item
View -> Indentation -> Convert Indentation To Spaces
I’ve tried the following, but can’t figure out how to trigger the option I see in the above mentioned menu
{ "keys": ["super+t"], "command": "convert_to_tabs" },
{ "keys": ["shift+super+t"], "command": "convert_to_spaces" },
Simple Version
Convert spaces to tabs (from Eric Muyser):
Convert tabs to spaces (from mVChr):
Original Answer Below
You could do it with one command each (
expand_tabsandunexpand_tabs), but it would also be a good idea to toggle “Indent Using Spaces”. Here is a macro that I saw somewhere (I forget where.)Macro Version
Tabs -> Spaces
Save as “convert_tabs_to_spaces.sublime-macro” inside of your “Packages/User” folder
Add this to your keybindings file:
Spaces -> Tabs
Similar file name and keybinding
I used this until I saw that you could left click the indentation setting in the Status Bar and change it from there.
Edit:
Plugin Version
adapted from here
“convert_tabs_to_spaces.py”
.
keybinding:
{ "keys": ["ctrl+shift+x"], "command": "convert_tabs_to_spaces"},“convert_spaces_to_tabs.py”
.
keybinding:
{ "keys": ["ctrl+shift+y"], "command": "convert_spaces_to_tabs"},