Android Studio undo (Ctrl-Z) / redo (Ctrl-Y) not working

AndroidAndroid StudioUndo Redo

Android Problem Overview


I've just moved from Eclipse to Android Studio and am finding really weird behaviour when I try to do Ctrl+Z / Ctrl+Y to undo/redo code changes.

It hard to describe what happens exactly, but the end result is that I usually end up just losing my code and having to type it back in from memory...

The 'undo' and 'redo' buttons in the IDE do seem to work fine, so maybe something is wrong with my shortcut keys (which would be surprising as I should just have a standard installation / setup).

Can anyone advise what to do, so Ctrl and Z / Ctrl+Y will work in the expected manner.

Android Solutions


Solution 1 - Android

With the help of this answer, I have worked it out...

  1. Go into Settings (Ctrl+Alt + S)
  2. Type Redo in the search box.
  3. Double-click on the Redo result
  4. Select Add Keyboard Shortcut
  5. Press Ctrl+Y
  6. Click OK
  7. Click OK

Solution 2 - Android

To undo an action, do one of the following:

On the MainMenu, choose Edit | Undo. Press Ctrl+Z

To redo an action, do one of the following:

On the Main menu, choose Edit | Redo. Press Ctrl+Shift+Z

Solution 3 - Android

ctrl+Y deletes line by default in Android. If you want to change this behaviour, go to Keymap under Settings and set your desired shortcut for Redo action

By the way, the same question: https://stackoverflow.com/q/25244475/5247331

Solution 4 - Android

You can try this one. It is simple and default:
(CTRL + Z) This is for undo.
Just press (CTRL + SHIFT + Z) for redo.
(CTRL + Y) it has individual task. So it would be better if you don't bother this one.

  1. CTRL + Z -> Undo
  2. CTRL + SHIFT + Z -> Redo
  3. CTRL + Y -> Delete line

Happy Coding

Solution 5 - Android

CTRL + Z works fine and undo the work but CTRL + Y is a bit messy combo. Unlike most software CTRL + Y here doesn't mean redo but its infact a shortcut to delete the entire line, hence you loose your code.
So if you wanna REDO use CTRL + SHIFT+Z(as already told above) or change keymapping.

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
Questionban-geoengineeringView Question on Stackoverflow
Solution 1 - Androidban-geoengineeringView Answer on Stackoverflow
Solution 2 - AndroidAreeb MahmoodView Answer on Stackoverflow
Solution 3 - AndroidVitaly ZinchenkoView Answer on Stackoverflow
Solution 4 - AndroidMafujulView Answer on Stackoverflow
Solution 5 - AndroidEkamjit SinghView Answer on Stackoverflow