I have the following problem.
I use ubuntu 12.04 and sublime-text-2 or gedit.
Sometimes i copy/paste something in a haml/ruby file, i indent it at 2 spaces, but when i push it up to github, the indentation is all wrong and not only the part I've copy/pasted. In my editor looks good.
If I open the file with LibreOffice/LeafPad the identation is like on github, but i wanna have it working on ST2.
Any suggestions?
Sublime Text editor provides various options for code indentation as shown in the following screenshot − Indent option helps to create indentation of the specified code. You have to select the code specified and select the Indent option. You can also use the shortcut Ctrl+ [ after selecting the required code that is to be indented.
In general, you should place your settings in Packages/User/Preferences.sublime-settings. If you want to specify settings for a certain file type, for example, Python, you should place them in Packages/User/Python.sublime-settings.
Indent Option Indent option helps to create indentation of the specified code. You have to select the code specified and select the Indent option. You can also use the shortcut Ctrl+ [ after selecting the required code that is to be indented.
Automatic indentation guesses the amount of leading whitespace to insert on each line when you press enter. It's controlled with these settings: Makes auto indent a little smarter, e.g., by indenting the next line after an if statement in C.
To have correct indent across the service you should not use hard tabs
http://opensourcehacker.com/2012/05/13/never-use-hard-tabs/
You can achieve this functionality in Sublime Text 2 with a tab policy setting:
http://opensourcehacker.com/2012/05/11/sublime-text-2-tips-for-python-and-web-developers/#Configure_sane_tab_and_whitespace_policy_and_other_settings
Also not that you might need to choose new policy for existing files from View > Indentation menu.
You can also mass-convert existing files away from tabs.
With Sublime Text 2:
http://opensourcehacker.com/2012/05/11/sublime-text-2-tips-for-python-and-web-developers/#Converting_existing_files_to_use_spaces_instead_of_tabs
... or batch convert the whole project:
http://miohtama.github.com/vvv/tools/expandtabs.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With