Well, some time ago I decided to use smart-tabs as my solution for the tabs vs spaces holy war. And more recently I decided to override the capslock in my macbook because, well, who uses caps-lock anymore? so I said: why not to override caps-lock to a fixed soft-tab (2 spaces), after some hours googling how to make something like this to work I came up with a hacky way to make it work with sublime text, I will share the links and steps if you want to get the same functionality
- First you need to disable the caps-lock key as showed here: (http://stackoverflow.com/a/8437594)
- In that same text they mention to install PCKeyboardHack, install it too, also we will need a complementary app named KeyRemap4MacBook they are from the same publisher
- Next, with PCKeyboardHack you will tick the Change Caps Lock and insert the 110 keycode ( PC Application Key )
- Now in KeyRemap4Macbook you will filter for PC Application Key or in For PC Users > Change PC Application Key and then tick Application Key to Option_L+Space ( you can choose from the other options but for me Option_L+space did work )
- From now on, everytime you press caps-lock will be the same as if you press option_left + spacebar
- Enter Sublime Text, you will need a macro so you want to open one, first Tools > record macro ( ^Q ), there you will press the spacebar twice, then Tools > stop recording and then Tools > save macro.
- Finally you will create a key binding to run the macro everytime you press alt (option) + space, so you go Preferences > Key Binding User and paste the next snippet
{ "keys": ["alt+space"], "command": "run_macro_file",
"args": { "file": "Packages/User/smart-spaces.sublime-macro" }
}
check if the file address is correct and if everything is ok now you will be able to use smart-tabs like a boss remembet that smart-tabs rules as tabs for indentation and spaces for alignment, now with caps-lock you can use the soft-tabs instead of smashing the spacebar.
Well, some time ago I decided to
use smart-tabsstop using tabs as my solution for the tabs vs spaces holy war. Fix'd ^_^'