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

不羁的心 提交于 2019-12-20 08:11:48

问题


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?


回答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.

  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.




回答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.



来源:https://stackoverflow.com/questions/25244475/how-to-configure-intellij-also-android-studio-redo-shortcut-to-ctrly-instead

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!