Created
June 4, 2013 15:50
-
-
Save joshmfrankel/5707020 to your computer and use it in GitHub Desktop.
Sublime: Convert 2 Spaces to 4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"args": null, | |
"command": "select_all" | |
}, | |
{ | |
"args": | |
{ | |
"set_translate_tabs": true | |
}, | |
"command": "unexpand_tabs" | |
}, | |
{ | |
"args": { | |
"setting": "tab_size", | |
"value": 4 | |
}, | |
"command": "set_setting" | |
}, | |
{ | |
"args": | |
{ | |
"set_translate_tabs": true | |
}, | |
"command": "expand_tabs" | |
} | |
] |
Thanks!
Thanks a lot for this!
For those of you (like me) initially confused on where to save the file, you can drop it here:
~/Library/Application Support/Sublime Text 3/Packages
To make it work I had to add tab_size setting to 2 before expanding:
[
{
"args": null,
"command": "select_all"
},
{
"args": {
"setting": "tab_size",
"value": 2
},
"command": "set_setting"
},
{
"args":
{
"set_translate_tabs": true
},
"command": "unexpand_tabs"
},
{
"args": {
"setting": "tab_size",
"value": 4
},
"command": "set_setting"
},
{
"args":
{
"set_translate_tabs": true
},
"command": "expand_tabs"
}
]
Worked better for me when translating spaces to tabs first:
[
{
"command": "select_all",
"args": null
},
{
"command": "expand_tabs",
"args": {"set_translate_tabs": true}
},
{
"command": "set_setting",
"args": {"setting": "tab_size", "value": 4}
},
{
"command": "unexpand_tabs",
"args": {"set_translate_tabs": true}
},
{
"command": "set_setting",
"args": {"setting": "tab_size", "value": 2}
},
{
"command": "expand_tabs",
"args": {"set_translate_spaces": true}
}
]
2 > 4 space
[
{
"command": "unexpand_tabs",
"args": {"set_translate_tabs": true}
},
{
"command": "set_setting",
"args": {"setting": "tab_size", "value": 2}
},
{
"command": "expand_tabs",
"args": {"set_translate_tabs": true}
},
{
"command": "unexpand_tabs",
"args": {"set_translate_tabs": true}
},
{
"command": "set_setting",
"args": {"setting": "tab_size", "value": 4}
},
{
"command": "expand_tabs",
"args": {"set_translate_tabs": true}
}
]
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I've created a macro to convert indentation from spaces to tabs, if anyone interested: https://gist.github.com/Edifice/7172119