Intellij中能否为Intention Actions窗口操作添加数字快捷键?
Absolutely, you can set up numeric shortcuts for IntelliJ's Intention Actions just like the String Manipulations plugin does—you don't even need a third-party plugin for core functionality. Here are two reliable methods to get this working:
1. Use Built-in Numbered Selection for All Intention Actions
IntelliJ has a hidden native feature that lets you select menu items by number once the Alt+Enter intention window pops up:
- Open the Settings/Preferences window (press
Ctrl+Alt+Son Windows/Linux,Cmd+,on macOS) - Navigate to Keymap and search for the action named
Choose Lookup Item by Number - Assign a shortcut combination to this action (I recommend
Alt+[0-9]since it won’t conflict with regular typing) - Now, when you press
Alt+Enterto bring up the intention menu, hitAlt+1,Alt+2, etc., to select the corresponding action in the list (the order matches the menu’s top-to-bottom sequence, even though numbers aren’t displayed visually)
2. Assign Direct Shortcuts to Specific Intention Actions
If you want a one-step shortcut for a frequently used action (like your example "Create object buzz") without opening the Alt+Enter menu first:
- Trigger
Alt+Enterand locate the specific action you want to shortcut - Right-click on the action in the menu and select Add Keyboard Shortcut
- Assign a unique shortcut (e.g.,
Ctrl+Alt+3)—double-check it doesn’t conflict with existing IDE shortcuts - From now on, you can execute that intention directly with your custom shortcut, no menu navigation required
A Quick Note on Plugins
You mentioned struggling to find a suitable plugin—most of the time, the built-in features above cover this use case perfectly. If you ever want visual number labels in the intention menu, you can keep an eye on the JetBrains Plugin Marketplace, but the native methods are stable and don’t add unnecessary bloat to your IDE.
内容的提问来源于stack exchange,提问作者Lau




