optional
optional

Reputation: 283

IntelliJ IDEA backspace and indention?

Here's two scenarios:

Eclipse (or perhaps even other programs?): If I indent, such as pressing tab or similar: Step 1: ( | is the caret )

public text(){
     |
}

Step 2: I press backspace:

 public text(){
 |
    }

See how one press of backspace moves back a whole indent since it's all empty space? Similarily, if I indent four times with TAB I'd press 4 backspaces, each moving one empty spaced indent.

Is this possible with IntelliJ because right now, I'm forced to spam the backspace key because it only moves back one step? As in, if I wanted to achieve the same result as in Step 2, I'd have to backspace like 4-5 times.

Upvotes: 12

Views: 12022

Answers (5)

ARK
ARK

Reputation: 4094

Press SHIFTTAB to unindent.

There is nothing in the preferences that will allow as simple as SHIFTTAB.

Upvotes: 0

Alex Ertl
Alex Ertl

Reputation: 388

If you're finding IntelliJ's backspace too aggressive, this will make it only delete one tab at a time (currently the default behavior deletes all the tabs on the current line and jumps the caret up to the end of the previous line).

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

Unindent on Backspace: To nearest indent position

Upvotes: 1

Keegan Lillo
Keegan Lillo

Reputation: 552

Just in case someone else stumbles upon this in the future, this is now a standard option found at:

Preferences -> Editor -> General -> Smart Keys. Then under the Backspace section choose the Unindent option you like

Upvotes: 25

sakis kaliakoudas
sakis kaliakoudas

Reputation: 2099

You may want to try this really handy plugin for intellij: hungry backspace It "eats" all the white spaces when you hit backspace! Something close to that but not as good would be typing ctrl + backspace.

Upvotes: 2

GareginSargsyan
GareginSargsyan

Reputation: 1895

When you press TAB in IntelliJ's Java editor by default you get 4 spaces instead of a single TAB character. You can change this behavior through File>Settings>Code Style>Java>Tabs and Indents. Just chek the 'Use tab character' check box.

Upvotes: 2

Related Questions