Change keyboard shortcut for "Duplicate Line(s)"

7 vues (au cours des 30 derniers jours)
ed
ed le 24 Mar 2022
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.

Réponses (1)

Simar
Simar le 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

Catégories

En savoir plus sur Desktop dans Help Center et File Exchange

Produits


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by