Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enable auto-indents in Pycharm?

Tags:

python

pycharm

When I create a function, the line right after the function does not automatically get indented. How can I do that?

def test_function():
    print("I do not get an automatic indent for this line")
#When I press enter it takes me back to this spot for the previous line

edit (Sorry for not being clear. I am coding in python 3 and in PyCharm)

like image 754
Collin Smith Avatar asked Sep 19 '25 04:09

Collin Smith


1 Answers

In my version of Pycharm (2019.3.2), you can go to File -> Settings, search for "Smart indent", and find the corresponding check box. If you enable, it will maintain indentation after hitting enter.


If the search in Settings isn't working for some reason, the full path is:

File -> Settings -> Editor -> General -> Smart Keys

like image 108
Carcigenicate Avatar answered Sep 23 '25 12:09

Carcigenicate