47

I occasionally need to go line-by line and change the indentation of the code.

Is there a shortcut in Pycharm where I can add spaces (format the indent) in the begining of multiple lines simultaneously without processing each line individually?

Wai Ha Lee
  • 8,598
  • 83
  • 57
  • 92
user1396713
  • 515
  • 1
  • 4
  • 8

7 Answers7

85

Highlight/ select the lines you want indented, then press TAB as often as needed until they reach the proper indent level.

You can remove spaces with SHIFT TAB.

You can also use CTRL+ALT+I to auto-indent the selection.

Oleg
  • 1,659
  • 13
  • 23
18

Select the block that you want to indent then press TAB. It will work.

Lilia
  • 462
  • 6
  • 22
4

To auto indent all the codes in Pycharm just press these sequencies:

CTR + A to select all the text files and then press

CTRL+ALT+I

JIST
  • 1,139
  • 2
  • 8
  • 30
Alfred
  • 56
  • 3
0

Select all that you want to indent, then do CTRL+ALT+I to indent all of it. This should work in Pycharm

0

Use shift +alt on windows machine

0

Continuation indent for Mac pro: Preferences -> Editor -> Code Style -> the language -> Tabs and Indents

Song
  • 593
  • 9
  • 21
0

If Ctrl + ALT + I is not working and every time needs to press the Insert button to get the pointer.

So go to Tools -> Select Vim if it is checked then it will be disabled.

Now you can intend code directly selecting multiple lines.

Vrushal Raut
  • 1,050
  • 2
  • 15
  • 20