{"id":340,"date":"2009-09-28T13:41:38","date_gmt":"2009-09-28T13:41:38","guid":{"rendered":"https:\/\/blogs.mathworks.com\/desktop\/2009\/09\/28\/configurable-keyboard-shortcuts-have-arrived\/"},"modified":"2009-09-28T13:41:38","modified_gmt":"2009-09-28T13:41:38","slug":"configurable-keyboard-shortcuts-have-arrived","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/community\/2009\/09\/28\/configurable-keyboard-shortcuts-have-arrived\/","title":{"rendered":"Configurable keyboard shortcuts have arrived"},"content":{"rendered":"<p><i><br \/>\nI&#8217;d like to welcome guest blogger Christina Roberts from the MATLAB Editor team. Christina was the lead developer on the configurable keyboard shortcuts feature.<br \/>\n<\/i><\/p>\n<p>R2009b has a new feature that I am particularly excited about: <a href=\"https:\/\/www.mathworks.com\/help\/releases\/R2009b\/techdoc\/index.html?\/access\/helpdesk\/help\/releases\/R2009b\/techdoc\/matlab_env\/br9elah.html#br5rvet\">user-configurable keyboard shortcuts<\/a> for the MATLAB desktop. This is a project that has been in the works for several years, and I am thrilled that it is now officially released.<\/p>\n<p>I will be splitting up my discussion of this feature into two posts. The first will give a high-level overview of the R2009b functionality, and the second will delve into the somewhat troubled history of keyboard shortcuts in MATLAB. I hope that you will learn some valuable tips from both posts and gain a better understanding of how to leverage customizable keyboard shortcuts.<\/p>\n<p>First, let me explain the layout of the keyboard shortcut preference panel. You can open it from the File Menu: <strong>File -> Preferences -> Keyboard -> Shortcuts<\/strong><\/p>\n<div align=\"center\">\n<a  href=\"https:\/\/blogs.mathworks.com\/images\/desktop\/christina_roberts_keyboard_shortcuts\/keyboard_shortcuts.png\"><img decoding=\"async\" border=\"0\" src=\"https:\/\/blogs.mathworks.com\/images\/desktop\/christina_roberts_keyboard_shortcuts\/keyboard_shortcuts_small.png\"><\/a><br \/>\n<\/a>\n<\/div>\n<p>The <em>Active settings<\/em> dropdown list at the top of the preference panel allows you to choose between different keyboard shortcut sets\u2014those that ship with the product, and customized sets that you may obtain from colleagues or <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/?term=tag%3A%22keyboard+shortcuts%22\">MATLAB Central<\/a>. The shortcut set selected by default matches common keyboard shortcuts on the platform on which you are running. For Windows and Macintosh, these are based on Windows and Macintosh platform standards, respectively. On UNIX, we decided to base our default keyboard shortcuts on the popular Emacs editor; however, if you are more comfortable with Windows-based keyboard shortcuts, that option is also available on UNIX.<\/p>\n<p>The Windows and Emacs sets are both available on non-Macintosh platforms, but the Macintosh Default Set is only available on Macintosh due to the usage of the Command key. In addition to our new default sets, we also ship a set representing the <a href=\"https:\/\/www.mathworks.com\/support\/solutions\/en\/data\/1-ANW4F9\/?solution=1-ANW4F9\">default keyboard shortcuts in R2009a<\/a>, specific to the platform on which you are running.<\/p>\n<p>To import a customized keyboard shortcut set, choose <em>Browse\u2026<\/em> from the <em>Active settings<\/em> combo box and navigate to the location of the set\u2019s XML file. If you would like to share your own customized set, use the <em>Save As\u2026<\/em> button to create an XML-representation of the set.<\/p>\n<div align=\"center\">\n<img decoding=\"async\" border=\"0\" src=\"https:\/\/blogs.mathworks.com\/images\/desktop\/christina_roberts_keyboard_shortcuts\/browse_and_save_as.png\">\n<\/div>\n<p>The top table of the preference panel lists all the actions that are configurable. You can search the contents of this table using the search field above it. For example, let\u2019s look at the actions relating to pasting an item from the clipboard:<\/p>\n<div align=\"center\">\n<a  href=\"https:\/\/blogs.mathworks.com\/images\/desktop\/christina_roberts_keyboard_shortcuts\/paste.png\"><img decoding=\"async\" border=\"0\" src=\"https:\/\/blogs.mathworks.com\/images\/desktop\/christina_roberts_keyboard_shortcuts\/paste_small.png\"><\/a><br \/>\n<\/a>\n<\/div>\n<p>You can see that there are three paste-related actions. The generic <em>Paste<\/em> action has the keyboard shortcuts Ctrl+V and Shift+Insert. These same keyboard shortcuts are also assigned to <em>Paste to Workspace<\/em> in the Workspace Browser, as indicated by the informational icon next to the actions as well as their tooltips.<\/p>\n<p>The middle table is where you can change assigned keyboard shortcuts, remove existing assignments, and add new ones. Let\u2019s assume that you want to change <em>Paste<\/em>\u2019s Ctrl+V shortcut to Ctrl+Shift+P. To do this, click in the table cell displaying Ctrl+V and press your new keyboard shortcut. The text representing the shortcut that you just pressed will then be displayed. Note that you can also insert multi-stroke keyboard shortcuts, popular in Emacs, by selecting <em>Limit to 2 keystrokes<\/em> from keyboard shortcut editor\u2019s context menu.<\/p>\n<div align=\"center\">\n<img decoding=\"async\" border=\"0\" src=\"https:\/\/blogs.mathworks.com\/images\/desktop\/christina_roberts_keyboard_shortcuts\/multi_stroke.png\">\n<\/div>\n<p>If you press the <em>Apply<\/em> or <em>OK<\/em> buttons, Ctrl+V will be replaced by Ctrl+Shift+P for all tools which support the <em>Paste<\/em> action. To see what tools these are, click in the table cell to the right of the new assignment. It is then possible to deselect some of these tools, if you do not wish for Ctrl+Shift+P to be assigned to <em>Paste<\/em> in all desktop tools.<\/p>\n<p>Now let\u2019s also assign Ctrl+V back to <em>Paste<\/em> in the Editor only. To do this, press the  <img decoding=\"async\" border=\"0\" src=\"https:\/\/blogs.mathworks.com\/images\/desktop\/christina_roberts_keyboard_shortcuts\/plus.png\">  button under the middle table. Then press Ctrl+V in the shortcut field, and finally deselect all the tools for that shortcut except the MATLAB Editor.<\/p>\n<div align=\"center\">\n<img decoding=\"async\" border=\"0\" src=\"https:\/\/blogs.mathworks.com\/images\/desktop\/christina_roberts_keyboard_shortcuts\/ctrl_v_editor.png\">\n<\/div>\n<p>Finally, the bottom table in the panel shows keyboard shortcut conflicts with the action currently being edited. In the example above, informational icons indicate that there are keyboard shortcuts assigned to <em>Paste<\/em> which are also assigned to <em>Paste to Workspace<\/em>.  However, since the Workspace Browser does not support the default <em>Paste<\/em> action, this is not an actual conflict. To create a real conflict, try replacing the Ctrl+Shift+P assignment with Ctrl+P.<\/p>\n<div align=\"center\">\n<a  href=\"https:\/\/blogs.mathworks.com\/images\/desktop\/christina_roberts_keyboard_shortcuts\/conflict.png\"><img decoding=\"async\" border=\"0\" src=\"https:\/\/blogs.mathworks.com\/images\/desktop\/christina_roberts_keyboard_shortcuts\/conflict_small.png\"><\/a><br \/>\n<\/a>\n<\/div>\n<p>When you make that change, an error icon appears, indicating that Ctrl+P is assigned to two or more actions within the same desktop tool. This means that you cannot use Ctrl+P for both <em>Paste<\/em> and <em>Print<\/em>, but you can instead choose to unassign Ctrl+P from <em>Print<\/em> by selecting the first row in the bottom table and pressing the <em>Unassign<\/em> button.<\/p>\n<p>If you now press the <em>OK<\/em> or <em>Apply<\/em> button, your modifications to the Windows Default Set will be retained in subsequent sessions of MATLAB. You can go back to the original Windows Default Set by selecting <em>Restore defaults<\/em>, or you could write this file out as a custom set by selecting <em>Save As\u2026<\/em>.<\/p>\n<p>That is a quick overview of how the preference panel works. In a future post, I will discuss the history of keyboard shortcuts in MATLAB and explain how we made some of our design choices.<\/p>\n<p><i>-by Christina Roberts, The MathWorks<\/i><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\nI&#8217;d like to welcome guest blogger Christina Roberts from the MATLAB Editor team. Christina was the lead developer on the configurable keyboard shortcuts feature.<\/p>\n<p>R2009b has a new feature that&#8230; <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/community\/2009\/09\/28\/configurable-keyboard-shortcuts-have-arrived\/\">read more >><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[3,2,4,33,8,9,11,6],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/posts\/340"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/comments?post=340"}],"version-history":[{"count":0,"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/posts\/340\/revisions"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/media?parent=340"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/categories?post=340"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/community\/wp-json\/wp\/v2\/tags?post=340"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}