- https://in.mathworks.com/help/releases/R2020b/matlab/matlab_env/keyboard-shortcuts.html
- https://in.mathworks.com/support/search.html/answers/805071-keyboard-shortcut-for-duplicating-a-line-of-code.html?fq%5B%5D=asset_type_name:answer&fq%5B%5D=category:matlab/desktop&page=1
Change keyboard shortcut for "Duplicate Line(s)"
8 views (last 30 days)
Show older comments
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.
0 Comments
Answers (1)
Simar
on 4 Oct 2023
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
0 Comments
See Also
Categories
Find more on Desktop in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!