apm install python-indent
Atom with easy PEP8 indentation…No more space bar mashing!
Python Indent is the indentation behavior you’ve been waiting for in Atom! You should no longer
have to worry about mashing your tab/space/backspace key every time you press
enter in the middle
of coding. Also, compared to other editors, there is no need to change an app configuration if you
want to have a mixture of different types of indents (namely hanging and opening-delimiter-aligned).
The main obstacle with Atom’s native indentation behavior is that it doesn’t yet have the necessary API’s to do what Python’s PEP8 style guide suggests. Enhancement requests and issues have been opened in Atom Core on a few occasions, but none have been resolved yet.
- language-python - Auto indent on line continuation with list/tuple
- atom - Autoindent not working properly
This package was made to give you expected indentation behavior; python-indent listens for
editor:newline events in Python source files, and when triggered, adjusts the indentation to
be lined up relative to the opening delimiter of the statement or “hanging” (for parameters,
tuples, or lists).
Both indent types for continuing lines as described in PEP 0008 – Style Guide for Python Code are auto-detected and applied by this package.
Aligned with Opening Delimiter
python def function_with_lots_of_params(param_1, param_2, param_3, param_4, very_long_parameter_name, param_6)
python def function_with_lots_of_params( param_1, param_2, param_3, param_4, very_long_parameter_name, param_6)
- Hanging Indent Tabs: Number of tabs used for hanging indents
def current_language_python_package(first_parameter, second_parameter,#
def with_python_indent_package_added(first_parameter, second_parameter, third_parameter): #<–properly dedents to here pass
def with_hanging_indent( first_parameter, second_parameter, third_parameter): pass
also_works_with_lists = [“apples”, “oranges”, “pears”, “peaches”, “mangoes”, “clementines”, “etc.”]#<–PEP8 continued indentation or_like_this = [ “apples”, “oranges”, “pears”, “peaches”, “mangoes”, “clementines”, “etc.” ]
There are plenty of other examples (ordinary and extraordinary) in the test_file.