Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 301
Akshar Patel Avatar asked Oct 16 '17 08:10

Akshar Patel


1 Answers

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

like image 130
Stephen Friedrich Avatar answered Nov 15 '22 11:11

Stephen Friedrich