Repository: spyder-ide/spyder

Issue:
2 or 4 spaces, not 3
_From [oliver.k...@gmail.com](https://code.google.com/u/115151849108725075229/) on 2014-02-18T01:48:07Z_

Spyder Version:  2.2.5
Python Version:  2.7.5
Qt Version    :  4.8.4, PyQt4 (API v2) 4.9.6 on Windows
pyflakes >=0.5.0:  0.7.3 (OK)
pep8 >=0.6      :  1.4.6 (OK)
IPython >=0.13  :  1.1.0 (OK)
rope >=0.9.2    :  0.9.4 (OK)
sphinx >=0.6.6  :  1.2 (OK)
matplotlib >=1.0:  1.3.1 (OK)
sympy >=0.7.0   :  0.7.4 (OK)
pylint >=0.25   :  1.0.0 (OK)

in
preferences -> editor -> advanced settings -> indentation characters
there are the options to use tabs, 2 spaces or 4 spaces.
However, I use 3 spaces in all of my sources (not only python). 
Even if the whole python community agree that only 2 or 4 spaces are valid, I still use 3.
There are so many versions: 2,3,4 spaces, tabs, and one need to configure
the editors all the time to use 3 spaces, and reformat code all the time,
etc etc etc. So I decided: I USE 3 SPACES.
Simple but tragic, that makes spyder COMPLETELY USELESS for me.
I like spyder a lot and will still use it, but in combiation with
a different editor or a workaround.
I would highly appreciate to have the option to use 3 spaces.
If this issue was already discussed, then sorry for the duplication, i didn't find an issue about three spaces.

_Original issue: http://code.google.com/p/spyderlib/issues/detail?id=1730_



Discussion:
This is more an issue of having support for different types of files and options for those files that remain so we could set spaces per extension. 

This is an enhancement issue, but a very low priority one. Nobody else has asked for this feature except the OP, so we could close it.

Agree, also I feel uneasy about supporting something so non -standard....

On the other hand it doesn't seem that complicated to do ? I haven't looked at the code but I suppose that it's a matter of changing a variable value ?

why not 5? 6? that is why I say is related to the extension, for python we should not encourage the use of spaces different from 2 or 4... (and I would like to eliminate tab.... but that is a whole different story)

5 and 6 are not between the options we already provide... I'd just prefer to let it rot as "help wanted" rather than closing it outright. If you really want to I'll let you do it !

What I mean is that although implementing this is in theory not an issue, 3 spaces (in python code at least) is not very standard and providing that option seems like encouraging bad practices somehow...

@goanpeca, I disagree.  I say provide a sensible default, but allow the user to choose what they want.  For example, in Sublime Text, you can choose between 1 and 8 spaces for tabs.

@blink1073 ok. This is just a thing to change in preferences an the rest would work, or is there something extra to do?

In theory everything should use `CodeEditor.indent_chars` which would point to this preference.


Resolving patch:
diff --git a/spyderlib/plugins/editor.py b/spyderlib/plugins/editor.py
--- a/spyderlib/plugins/editor.py
+++ b/spyderlib/plugins/editor.py
@@ -204,9 +204,14 @@ def setup_page(self):
         autounindent_box = newcb(_("Automatic indentation after 'else', "
                                    "'elif', etc."), 'auto_unindent')
         indent_chars_box = self.create_combobox(_("Indentation characters: "),
-                                        ((_("4 spaces"), '*    *'),
-                                         (_("2 spaces"), '*  *'),
-                                         (_("tab"), '*\t*')), 'indent_chars')
+                                        ((_("2 spaces"), '*  *'),
+                                         (_("3 spaces"), '*   *'),
+                                         (_("4 spaces"), '*    *'),
+                                         (_("5 spaces"), '*     *'),
+                                         (_("6 spaces"), '*      *'),
+                                         (_("7 spaces"), '*       *'),
+                                         (_("8 spaces"), '*        *'),
+                                         (_("Tabulations"), '*\t*')), 'indent_chars')
         tabwidth_spin = self.create_spinbox(_("Tab stop width:"), _("pixels"),
                                             'tab_stop_width', 40, 10, 1000, 10)
         tab_mode_box = newcb(_("Tab always indent"),


Test patch: