Delete/select everything on line except leading whitespace with a single invocation of a keyboard shortcut

已回答

Can the following be done with a single keyboard shortcut, invoking it only once?

Let ^ represent the current caret position.

...
int ^i = 0;
...

Invoke shortcut. Result:

...
^
...

Or, instead of deleting, the whole line except leading whitespace in selected.

This is often what I want to do, but right now I either delete the whole line and insert a new line, or expand selection as many times needed in order to select everything expect leading whitespace.

0

Hello,

Please try to use "Edit | Extend selection" action.

0

Oh I  guess I should have phrased my question "Can the following be done with a single keyboard shortcut, invoking it only once?" With Extend selection, you have to invoke multiple times depending on on complexity of the statement.

0

No, it's not possible with single shortcut. Feel free to create feature request on YouTrack: https://youtrack.jetbrains.com/issues/IDEA

0

Will do, thank you.

EDIT:

A simple macro can do this right now:
Delete Line followed by Start New Line Before Current.

0

Sopi Thank you for the macro workaround!

0

请先登录再写评论。