Request - Hungry Backspace (from Emacs cc-mode)

Emacs cc-mode has this great feature called Hungry Delete.

The backspace key is "hungry". When you press it it eats up all the whitespace until it finds a non-whitespace character.

The simplist example is you type a line like
for (int i = 0; i < n.length; i++) {
|

and the cursor gets indented on the next line. If you hit BACKSPACE in IDEA Intellij, you have to type it repeatedly to remove the spaces and newline. Worse, the number of times you need to press BACKSPACE depends on the indent level.

With the Hungry Backspace, you never have to think about this because you only have to press BACKSPACE once no matter what the indent level and no matter how many blank lines there are..

Can this feature be implemented in a Plugin or would it have to be in IDEA core?

Thanks,
-Alex

6 comments
Comment actions Permalink

Alex,

I've requested such an behaviour for lines, that just contain whitespace.
Suppose, you have a code like this (--> is a tab, | the caret):

>>

}

pressing backspace, should (IMO) treat the line containing just whitespace
as a empty line.

Tom

PS: Have you entered a RFE in the tracker?


On Sun, 18 May 2003 01:04:28 +0000 (UTC), Alex <alexws@xemaps.com> wrote:

> Emacs cc-mode has this great feature called Hungry Delete.
>
> The backspace key is "hungry". When you press it it eats up all the
> whitespace until it finds a non-whitespace character.
>
> The simplist example is you type a line like
> for (int i = 0; i < n.length; i++) {
>

>

and the cursor gets indented on the next line. If you hit BACKSPACE in
IDEA Intellij, you have to type it repeatedly to remove the spaces and
newline. Worse, the number of times you need to press BACKSPACE depends
on the indent level.

>

With the Hungry Backspace, you never have to think about this because you
only have to press BACKSPACE once no matter what the indent level and no
matter how many blank lines there are..

>

Can this feature be implemented in a Plugin or would it have to be in
IDEA core?

>

Thanks,
-Alex



0
Comment actions Permalink

I asked a long time ago for this and Duane Fields added to his text plugin.
Unfortunately it had a bug that I fixed in the attached version

Enjoy

Jacques
"Thomas Singer" <thomas.singer@noregnisspam.de> wrote in message
news:oprperdpx2mxlxr0@news.intellij.net...

Alex,

>

I've requested such an behaviour for lines, that just contain whitespace.
Suppose, you have a code like this (--> is a tab, | the caret):

>

>>
|}

>

pressing backspace, should (IMO) treat the line containing just whitespace
as a empty line.

>

Tom

>

PS: Have you entered a RFE in the tracker?

>
>

On Sun, 18 May 2003 01:04:28 +0000 (UTC), Alex <alexws@xemaps.com> wrote:

>

Emacs cc-mode has this great feature called Hungry Delete.

>

The backspace key is "hungry". When you press it it eats up all the
whitespace until it finds a non-whitespace character.

>

The simplist example is you type a line like
for (int i = 0; i < n.length; i++) {
|

>

and the cursor gets indented on the next line. If you hit BACKSPACE in
IDEA Intellij, you have to type it repeatedly to remove the spaces and
newline. Worse, the number of times you need to press BACKSPACE depends
on the indent level.

>

With the Hungry Backspace, you never have to think about this because

you

only have to press BACKSPACE once no matter what the indent level and no
matter how many blank lines there are..

>

Can this feature be implemented in a Plugin or would it have to be in
IDEA core?

>

Thanks,
-Alex

>
>





Attachment(s):
text.jar
0
Comment actions Permalink

Jacques, send myour fix src and I'll integrate it...


--
Duane Fields
Deep Magic Software and Consulting
http://www.deepmagic.com


"Jacques Morel" <jacmorel@yahoo.com> wrote in message
news:bacng3$9lb$2@is.intellij.net...

I asked a long time ago for this and Duane Fields added to his text

plugin.

Unfortunately it had a bug that I fixed in the attached version

>

Enjoy

>

Jacques
"Thomas Singer" <thomas.singer@noregnisspam.de> wrote in message
news:oprperdpx2mxlxr0@news.intellij.net...

Alex,

>

I've requested such an behaviour for lines, that just contain

whitespace.

Suppose, you have a code like this (--> is a tab, | the caret):

>

>>
|}

>

pressing backspace, should (IMO) treat the line containing just

whitespace

as a empty line.

>

Tom

>

PS: Have you entered a RFE in the tracker?

>
>

On Sun, 18 May 2003 01:04:28 +0000 (UTC), Alex <alexws@xemaps.com>

wrote:

>

Emacs cc-mode has this great feature called Hungry Delete.

>

The backspace key is "hungry". When you press it it eats up all the
whitespace until it finds a non-whitespace character.

>

The simplist example is you type a line like
for (int i = 0; i < n.length; i++) {
|

>

and the cursor gets indented on the next line. If you hit BACKSPACE in
IDEA Intellij, you have to type it repeatedly to remove the spaces and
newline. Worse, the number of times you need to press BACKSPACE

depends

on the indent level.

>

With the Hungry Backspace, you never have to think about this because

you

only have to press BACKSPACE once no matter what the indent level and

no

matter how many blank lines there are..

>

Can this feature be implemented in a Plugin or would it have to be in
IDEA core?

>

Thanks,
-Alex

>
>

>
>
>


0
Comment actions Permalink

Hello,

I tried the text.jar but that wasn't exactly what I want. That action only removes whitespace.

I want to override BACKSPACE key, so if the caret is to the right of non-whitespace, it needs to act like regular backspace.

I threw together a small plugin with one action CCMODE.HungryDelete which does what ccmode auto-hungry-delete does.

Try it out if you are interested. If ind that once you get used to it, it becomes very addictive!! IDEA should make this the default BACKSPACE key IMO.



Attachment(s):
ccmode.jar
0
Comment actions Permalink


You will have to remap BACKSPACE and shift BACKSPACE to CCMODE.HungryDelete under the Other folder in order to try it out.

Works great for me so far. But this is my first plugin, so there may be problems.

-Alex

0
Comment actions Permalink

I have a Request #12356 - Hungry Backspace (from Emacs cc-mode)
http://www.intellij.net/forums/thread.jsp?forum=15&thread=29998

I think this is an important productivity booster and should be added as an option to IDEA under Editor->SmartKeys->Hungry Backspace

0

Please sign in to leave a comment.