Akshar Patel
Akshar Patel

Reputation: 9378

Delete Current Word in IntelliJ IDEA/Android Studio

How to delete a current word(word at a caret)?

Below solution forces to put caret at start or end of the word, but that is not very convenient.

Ctrl-BACKSPACE
Delete to word end from caret.
Ctrl-DEL
Delete to word start from caret.

Other solution is to select word using Ctrl + W and then delete it but it is also two steps process.

Is there any shortcut or setting which can delete current word in a single step?

Upvotes: 7

Views: 5788

Answers (1)

eekboom
eekboom

Reputation: 5812

IDEA macro feature is usable here:

  • Open an editor and place the caret in a word
  • Main menu: Edit -> Macros -> Start Macro Recording
  • Press Ctrl-W, then Delete
  • Main menu: Edit -> Stop Macro Recording
  • A dialog pops up where you can enter a macro name like "Delete Word at Caret"
  • Assign a keyboard shortcut: Main menu: File -> Settings, then Keymap -> Macros, "Delete Word at Caret"

I see you have already created a tcket in YouTrack: https://youtrack.jetbrains.com/issue/IDEA-180648

Upvotes: 9

Related Questions