How to configure IntelliJ (also Android Studio) redo shortcut to CTRL+Y instead of CTRL+SHIFT+Z?

51,378

Solution 1

  1. Open Settings (press CTRL+ALT+S)

  2. Click Keymap on the left list.

  3. There is a combobox that contains keymaps. Select one of them (default means IntelliJ of course. We can't change any of pre-defined keymap however we can copy, edit and then use the edited one. So) we should copy "default" to change only redo mapping.copy default keymap

  4. Give a new name to your copied keymap.

  5. Right click on: Main Menu -> Edit -> Redo to click "Add Keyboard Shortcut"

  6. Press CTRL+Y

  7. Click OK

  8. Click "Remove" to "the shortcut is already assigned to other actions. Do you want to remove other assignments?"

  9. If you want to use any "remove line" shortcut also, then go to delete line shortcut and give to it any other shortcut (like 5th step)

  10. Click OK to close settings window.

Solution 2

Change the keymap setting to the Visual Studio, Eclipse, or NetBeans preset.

The settings window can be found under File > Settings. CTRL+ALT+S should work if the shortcut hasn't been changed. In the settings window you should find Keymap under the Appearance & Behavior settings list.

You can configure each editor command to a key combo that you like (as @ismail yavuz mentioned) such as for Redo to CTRL+Y or you can just change the Keymap setting to an editor that you are used to. This might be best if you are in the process of switching to IntelliJ as it is probably the path of least resistance. The default settings for the Visual Studio, Eclipse, and NetBeans keymaps all map Redo to CTRL+Y.

The Principle of least astonishment is strangely violated for Windows users but at least shortcuts is customizable. Because of this command being so contrary to the Windows experience I decided it wasn't worth learning the IntelliJ keyboard when anywhere you're working at you need to, you can quickly change. There are almost no drawbacks to not learning the IntelliJ. Remember that in the keymap menu you can search for a command in the search box or click on the magnifying glass on the right to search by key combo.

Of course neither answer is wrong. Chose your preference.

Share:
51,378

Related videos on Youtube

Ismail Yavuz
Author by

Ismail Yavuz

Spring boot, Hibernate, SQL Server, PostgreSQL, Ubuntu, Microservices, Netty, GIS, MQTT, Docker Contact me for any reason: [email protected]

Updated on April 25, 2020

Comments

  • Ismail Yavuz
    Ismail Yavuz about 4 years

    The default IntelliJ / Android Studio "Redo" action shortcut is CTRL+Shift+Z and this is a common problem for Windows users.

    A bigger problem is CTRL+Y is mapped to the "Delete line" action - and this causes the undo stack to be lost.

    To solve this issue, how can the "Redo" shortcut be changed to CTRL+Y in IntelliJ?

    • Ismail Yavuz
      Ismail Yavuz almost 10 years
      Windows users use "CTRL+Y" to redo action by default. I want to redo my last undo. Then i press ctrl+y by mistake to redo. My current line has deleted. I made a change right? So i can't ctrl+shift+z anymore because of ctrl+y! youtrack.jetbrains.com/issue/IDEA-120080
    • Ismail Yavuz
      Ismail Yavuz almost 10 years
      This is true for all other applications i use including eclipse, notepad++ and chrome..
    • Usman
      Usman almost 9 years
      i just lost a tons of code, due to this. i undo the work to see something and pressed Ctrl+Y, now i have to write all again. :(
    • Mahendran
      Mahendran almost 9 years
      This is really annoying that Intllij shortcuts not adheres to platform. I assume these meant for mac. ex: try ctrl + alt + Left/Right for navigation.
    • Wouter
      Wouter about 7 years
      There is a "bug report" on this. You can vote on it to urge changing this default on Windows: youtrack.jetbrains.com/issue/IDEA-161842
    • Jaxx0rr
      Jaxx0rr over 6 years
      I just wonder how high they were when they decided to use CTRL+Y for delete line..
    • arthropod
      arthropod over 6 years
      I was so glad when I happened to spam Ctrl+Y to redo because it was just a pet project.
    • Tim Tyler
      Tim Tyler over 6 years
      Not the paranoid type but it feels intentional, like a nix L33t practical joke on Windows users for the lulz!
  • nemoo
    nemoo about 9 years
    In Intellij 14.1.2, right clicking on: Main Menu -> Edit -> Redo will not let me "Add Keyboard Shortcut"
  • Ismail Yavuz
    Ismail Yavuz about 9 years
    Did you copy the original keymap? You can not change the original keymaps. You have to copy one and then change what do you want to change. Please follow all steps above.
  • nemoo
    nemoo about 9 years
    Now i get it. I erroneously went to the Main Menu and then tried to right click Edit -> Redo because i couldn't find 'Redo' in the list in the settings screen. It can be found via Search, though.
  • degreesightdc
    degreesightdc over 4 years
    Thank you! Spot on.