vladCovaliov
vladCovaliov

Reputation: 4403

Indentation issue using sublime text 2

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?

Upvotes: 7

Views: 14876

Answers (1)

Mikko Ohtamaa
Mikko Ohtamaa

Reputation: 83768

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

Upvotes: 6

Related Questions