Android Studio delete line and duplicate line shortcuts

Android StudioKeyboard Shortcuts

Android Studio Problem Overview


What is the shortcut in Android Studio to delete a line? And what is the shortcut to duplicate a line?

I found the answer in the documentation and I am posting it below for quick reference.

Android Studio Solutions


Solution 1 - Android Studio

Linux/Windows

  • Control + D : Duplicate current line or selection
  • Control + Y : Delete current line

Note from comments: Shift + Delete cuts the current line.

Mac

  • Command + D : Duplicate current line or selection
  • Command + Delete : Delete current line

See also

If it's not working, check the Keymap settings:

enter image description here

Solution 2 - Android Studio

On Mac OS 11.3.1 and above just :

delete line completely :

Command + delete

and duplicate line :

command + d

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionSuragchView Question on Stackoverflow
Solution 1 - Android StudioSuragchView Answer on Stackoverflow
Solution 2 - Android StudioSana EbadiView Answer on Stackoverflow