0
votes

I am using Sublime Text 3 with the Packet Manager, and installed SublimeLinter and then SublimeLinter-flake8.

I want to use tabs for indentation, but I can't find out how. I can't actually find any indentation that works, because if I put one space it says: flake8: E111 - indentation is not a multiple of four, but when I put four spaces it says: flake8: E101 - indentation contains mixed spaces and tabs.

I am on Windows and using Python 3. Does anyone know how to change the settings?

1
Can you elaborate what the exact problem is? You seem to mixing tabs and spaced, when you should only use tabs or spaces. Why can't you use tabs? - idleberg
in the pep8 formatting, you need to use 4 spaces, not a tab. I want to use tabs and was wondering if there is an option to let me use tabs. Thanks - Artemis
I think this is a Flake8 question and not a Sublime Text one but a mixture of spaces and tabs can be easily converted from one to the other with Sublime Text. Left click on the status bar where it says either Spaces:Num or Tab Size:Num. The menu displayed allows conversion to and from tabs and spaces, setting the indent width, and the Indent Using Spaces tick box allows you to swap between spaces and tabs (if un-ticked then indentation will be using tabs). - mattst

1 Answers

0
votes

This is answered in the flake8 documentation:

Flake8 supports storing its configuration in the following places:

  • Your top-level user directory
  • In your project in one of setup.cfg, tox.ini, or .flake8.

Values set at the command line have highest priority, then those in the project configuration file, then those in your user directory, and finally there are the defaults. However, there are additional command line options which can alter this.

Since this is editor-agnostic, this should be the favoured approach. Also, you keep flexibility when working with configurations at project-level.

However, you can also specify your flake8 arguments in the SublimeLinter configuration, exactly as described in the documentation for SublimeLinter-flake8. Keep in mind that this is a very unflexible solution since it requires editing if you're using different configuration settings across your projects.