Registering some transient/temporary keyboard shortcuts
已回答
I have an EditorActionHandler which basically implements search in the current editor. I would like to register some "temporary" keyboard shortcuts (such as for example ctrl-w) that are only available when the search is active, and then gone again when the search is over.
In other words, I do not want to modify the main active keyboard layout, but only register a few additional keyboard shortcuts that are activated during the search.
How would I best go about doing this? I have tried using variants of "action.registerCustomShortcutSet(...)" on the editor component, but this doesn't seem to block the existing actions for the keyboard shortcuts.
请先登录再写评论。
Hi Jesper,
Using AnAction.registerCustomShortcutSet() seems fine. When multiple actions are assigned to the same shortcut, then the preferred one can be promoted with:
I suggest promoting your action when your custom search is active.