268

It's so easy to select a block of code and tab out, but how about the reverse?

Currently, I just search and replace for white space at the beginning of the line. Is there anything faster?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Keith Bentrup
  • 11,834
  • 7
  • 49
  • 56

11 Answers11

563

In Visual Studio and most other half decent IDEs you can simply do SHIFT+TAB. It does the opposite of just TAB.

I would think and hope that the IDEs you mention support this as well.

L Y E S - C H I O U K H
  • 4,765
  • 8
  • 40
  • 57
nbevans
  • 7,739
  • 3
  • 27
  • 32
23

Shift-tab outdents again :)

The standard shortcut keys are covered in Standard Accelerators.

You'll find many of the more esoteric ones on FAQ What editor keyboard shortcuts are available?.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Jeremy Smyth
  • 23,270
  • 2
  • 52
  • 65
13

Here is a general answer for untab:

In Python IDLE: Ctrl + [

In Eclipse: Shift + Tab

In Visual Studio: Shift + Tab

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Shubham Sharma
  • 1,753
  • 15
  • 24
  • The IDLE one is an example of one that is only suited for an [American keyboard layout](https://en.wikipedia.org/wiki/British_and_American_keyboards#Windows_keyboards). E.g., Shift + AltGr + 8 is just not practical. – Peter Mortensen Oct 09 '22 at 13:28
8

In general, Shift + Tab works for any environment.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Luis Parada
  • 109
  • 1
  • 4
6

This workaround works most of the time. It uses Eclipse's 'smart insert' features instead:

  1. Control + X to erase the selected block of text, and keep it for pasting.
  2. Control + Shift + Enter, to open a new line for editing above the one you are at.
  3. You might want to adjust the tabbing position at this point. This is where tabbing will start, unless you are at the beginning of the line.
  4. Control + V to paste back the buffer.

I hope this helps until Shift + TAB is implemented in Eclipse.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Ohad Aloni
  • 109
  • 1
  • 2
5

Shift + Tab does that in Flex Builder (based on Eclipse), so it hopefully should work in regular Eclipse :)

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Richard Walton
  • 4,789
  • 3
  • 38
  • 49
5

In PyCharm, just use Shift + Tab to move a block of code left.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Sanky Cse
  • 171
  • 1
  • 2
  • 8
3

Yes, in PyCharm: Shift + Tab works fine.

2

You can do this by going to the Window menu → Preferences, and then open the General list. Choose Keys.

Scroll down the list of keys until you see "Shift Left". Click that. Below that, you'll see some boxes, one of which lets you bind a key. It won't accept Shift + Tab, so I bound it to Shift + `. Apply Apply and Close, and you're all set.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Johnny Wales
  • 467
  • 2
  • 5
  • 15
1

Yes, You can do this in VS Code & Same works in most of IDE with the help of Shift + Tab.

Process :

a) Select the code you want to take one tab back. b) Press SHIFT + TAB

Yugal
  • 21
  • 6
0

You can also change the shortcut. Use the Command + K, Command + S shortcuts to open the Keyboard Shortcut menu. Search for the "tab" and find the "outdent" in the list.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131