tags:

views:

159

answers:

2

I have replaced all my tabs by spaces in my PHP code source (and I configured Eclipse to use 4 spaces as tabs). When I hit tab, I get 4 spaces, that's OK.

But when I hit backspace to remove an indentation level (a tab), it removes only one space. So I have to hit 4 times space to remove an indentation level.

That is one of the most absurd thing I've seen in Eclipse, so I guess there is an option somewhere to enable us to remove 4 spaces as if it where a tab ? or a plugin ?

+2  A: 

Don't think there is a way to set it to delete the entire space indentation with backspace, but shift+tab should do what you want.

Tjkoopa
Yes you're right, but as you may feel to, I greatly prefer to have this behavior with backspace to (for example when deleting code, and in the continuation you delete indentation, you don't want to change of key). Isn't there a plugin for that ? How PHP developpers do, its almost giving me nightmares, I now hate Eclipse for that.
Matthieu
Why don't you just bind Backspace to "Shift-Left", then? (Personally I like to have Eclipse do a full source file format on save (according to the formatting rules), which saves me the brain-ache of maintaining proper indentation.)
JesperE
If I do bind backspace to "Shift-tab", I will mess with the initial behavior of the backspace key and I wont be able to erase anything (well I guess it will do that). I just dont understand how such a basic functionnality isn't possible in this really advanced tool.
Matthieu
A: 

So... I also need that feature. Before a began to use Eclipse, I was a Vim user. Actually a still use it for some edit task. There is a vimplugin for eclipse, so you can use it as your Eclipse editor. But its a matter of taste.

You can configure vim to do exactly that: Tab insert 4 spaces. Backspaces deletes indentations.

Here the config for your settings:

set tabstop=8       " This is the default in any editor, Tabs are 8spaces Wide"
set expandtab       " Tabs are converted to spaces"
set softtabstop=4   " Tabs are 4 spaces"
set shiftwidth=4    " Indent is 4 spaces"
" Here the magic"
set backspace=indent,eol,start  " Deletes over indent, line breaks, edit starts"

HTH

Asturio