简体   繁体   中英

How can i change indentation settings for flake8 in sublime text?

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM