Backspace to beginning of line in IntelliJ
Asked Answered
D

1

7

Pretty much everywhere in OSX, it's possible to backspace all the way to the beginning of a line using command+Backward delete. I can't find a way to set up this behaviour within IntelliJ IDEA, and I find this very...

...backward.

Dedans answered 11/8, 2014 at 2:38 Comment(0)
A
4

Here are some basic keyboard shortcuts:

  • Move Caret to Word Start: Ctrl+Left.
  • Move Caret to Line Start: Home
  • Delete from Caret to Word Start: Ctrl+Backspace
  • Delete from Caret to Line Start: Shift+Home, Delete

I assume you want to Delete from Caret to Line Start ("backspace to beginning of line").

If you want to execute this action with a single key, simply record a macro and assign a keyboard shortcut for it.

  • Menu -> Macros -> Start Macro Recording
  • Press Shift+Home
  • Press Delete
  • Menu -> Macros -> Stop Macro Recording
  • Assign a name, for example "Delete to Line Start"
  • Assign a shortcut to your macro: Menu -> File -> Settings -> Keymap

Here's a screenshot of the settings dialog. I tested it and it works fine. Assign a shortcut to your macro

Ariminum answered 11/8, 2014 at 7:18 Comment(4)
I don't think he's asking about moving the caret but rather deleting from caret position to line start. This is the default behavior in OS X.Belligerent
Thanks, I am a Windows user and was not aware of this.Ariminum
@Belligerent please review again; I modified my answer and now describe how "delete from caret position to line start" by recording a macro with two key strokes and execute it with a single key shortcut. Works fine!Ariminum
Thanks, at least this works OK. Only problem is when you undo the text you deleted is selected (not a huge problem... yet ;P).Belligerent

© 2022 - 2024 — McMap. All rights reserved.