Reassigning shortcuts

Hi @ctrueden, @Wayne

Is there also a way to re-assign ShortCuts using java in a running IJ instance (without changing the StartupMacros.txt)? Specifically, I would like to use the letters 1,2,3,4,5 for my application, but they are used already.


Create a string containing macros that define the shortcuts and install the macros using the MacroInstaller.install(string) method. Here is a JavaScript example that creates shortcuts for the 1, 2, 3, 4 and 5 keys:

macros = "macro 'shortcut 1 [1]' {print('one')};\n"
+ "macro 'shortcut 2 [2]' {print('two')};"
+ "macro 'shortcut 3 [3]' {print('three')};"
+ "macro 'shortcut 4 [4]' {print('four')};"
+ "macro 'shortcut 5 [5]' {print('five')};";
new MacroInstaller().install(macros);

Thank you very much for the answer!