Gedit Settings : Insert Spaces instead of Tab.

This week I wrote my first piece of code using Python. I had to if I wanted to use scrapy.  This was also the week when I realized how important white spaces and indentation is to write a code in Python.

And then there is this hard tab length disagreement. Gedit that I used in Ubuntu uses 8 spaces for tab and some other editors use 4 or 6 spaces. That made the editing of code on different machines a big headache. It’s either don’t use tabs at all, or stick to a single editor .

Fortunately there is a setting in Gedit that can let you use tabs, and let it insert a set number of spaces for you instead of inserting a hard tab char. This means you can still save on keystrokes while maintaining your code porability.

To use it , go to gedit preferences, editor and tick “Insert Spaces instead of Tabs” . You can also tick “Enable automatic indentation” so it automatically inserts spaces for you.