45

Does anyone know the shortcut for shifting a block of code in IntelliJ over by a few indents?

(For the CSS editor, Coda, I used to select the block or blocks of code and use the shift and left or right carrot symbols to shift the code right or left.)

Adi Sivasankaran
  • 518
  • 3
  • 6
  • 20
Chapsterj
  • 6,483
  • 20
  • 70
  • 124

2 Answers2

122

These are common Indent and Unindent actions, default shortcuts: Tab and Shift+Tab.

CrazyCoder
  • 389,263
  • 172
  • 990
  • 904
  • 4
    Shift-Tab doesn't move my block of code four spaces to the left. It does nothing. – Michael Lafayette Jan 23 '16 at 19:22
  • 1
    Check your keymap and remap if needed. – CrazyCoder Jan 23 '16 at 20:52
  • 2
    It's just that on Netbeans if you have "Hello |World" and you tab it, it becomes "Hello |World" and then if you Shift-Tab it, you reverse that operation and go back to "Hello |World". Shift-Tab on IntelliJ only works if you indent at the very beginning of the line. – Michael Lafayette Jan 24 '16 at 02:19
  • 1
    I had to remove bindings for "Next Parameter" and "Prev/Previous Parameter" for this to mostly work like I'm expecting. – jimmyorr Jan 17 '20 at 17:07
0

In keymap, find Unindent line of selection then right click to add Shift+Tab as the shortcut:

Unindent line of selection

zeljko_a
  • 3,725
  • 1
  • 22
  • 23