Change keyboard shortcut for "Duplicate Line(s)"

7 ビュー (過去 30 日間)
ed
ed 2022 年 3 月 24 日
回答済み: Simar 2023 年 10 月 4 日
If I select a section of text and right-click on it I get the option to "Duplicate Line(s)", and it has a keyboard shortcut (on mac it's "shift-command-c"). How can I change this shortcut? I want the shortcut to be the same as my other software. I can't find this option under Preferences > Keyboard > Shortcuts.
I'm using 2022a.

回答 (1 件)

Simar
Simar 2023 年 10 月 4 日
Hi ed,
It is my understanding that you want to change Duplicate Lines Shortcut.
In MATLAB 2022a, the ability to customize keyboard shortcuts for specific editor actions is not available in the Preferences menu. However, you can achieve this customization by manually modifying the MATLAB keyboard shortcut configuration file. Here is how you can do it:
1.Locate the MATLAB keyboard shortcut configuration file. On macOS, the file is typically located at: /Applications/MATLAB_R2022a.app/toolbox/matlab/ide/keyboard_shortcuts.json
2. Open the ‘keyboard_shortcuts.json’ file in a text editor.
3.Search for the section that contains the "Duplicate Line(s)" action. It should look something like this:
{
"Category": "Editor",
"Action": "EditorDuplicateLines",
"Shortcut": "Shift + Command + C"
}
4. Modify the "Shortcut" field to your desired keyboard shortcut. For example, if you want to change it to "Shift+ Command + D", update the line to:
"Shortcut": "Shift + Command + D"
5.Save the ‘keyboard_shortcuts.json’ file.
6. Restart MATLAB for the changes to take effect.
After following these steps, the "Duplicate Line(s)" action should now have your desired keyboard shortcut.
Please note that modifying keyboard shortcuts configuration file is an advanced customization technique, and it is always a good idea to make a backup of the original file before making any changes.
You can also refer to the following links below:
Best Regards,
Simar

カテゴリ

Help Center および File ExchangeDesktop についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by