{"id":12145,"date":"2024-05-01T11:45:53","date_gmt":"2024-05-01T15:45:53","guid":{"rendered":"https:\/\/irreal.org\/blog\/?p=12145"},"modified":"2024-05-01T11:45:53","modified_gmt":"2024-05-01T15:45:53","slug":"should-you-use-key-shortcuts-or-m-x","status":"publish","type":"post","link":"https:\/\/irreal.org\/blog\/?p=12145","title":{"rendered":"Should You Use Key Shortcuts or M-x"},"content":{"rendered":"<p>\nOver at the Emacs subreddit, domsch1988 has an <a href=\"https:\/\/www.reddit.com\/r\/emacs\/comments\/1ccmwhm\/keybinds_or_mx\/\">interesting question<\/a>: Is it better to use key shortcuts or <kbd>Meta<\/kbd>+<kbd>x<\/kbd>? The question is not as silly as it seems. Domsch1988 acknowledges that sometimes the choice is obvious. No one, for example, is going to invoke <kbd>Meta<\/kbd>+<kbd>x<\/kbd> <code>find-file<\/code> instead of <kbd>Ctrl<\/kbd>+<kbd>x<\/kbd> <kbd>Ctrl<\/kbd>+<kbd>f<\/kbd>. Likewise, there are plenty of commands that, even if they have key shortcuts, you use so seldomly that you simply won&rsquo;t remember a shortcut.\n<\/p>\n<p>\nSo the question is, how do you choose the best method? It&rsquo;s interesting to read through the comments. One of the best pieces of advice, I think, is to use a <a href=\"https:\/\/github.com\/abo-abo\/hydra\">hydra<\/a> or <a href=\"https:\/\/github.com\/magit\/transient\">transient<\/a> to capture diverse, hard to remember commands in a menu-like interface. For example, I have a hydra for dealing with windows. All the window commands I use, even infrequently, are gathered there and can be invoked with a simple key command. If I forget the whole command, a short menu will pop up in the minibuffer to remind me. It&rsquo;s a lot like <a href=\"https:\/\/github.com\/justbur\/emacs-which-key\">which-key<\/a> except that there only a few choices so I don&rsquo;t have to hunt through a bunch of choices to find the command I want.\n<\/p>\n<p>\nTo be sure, a key shortcut is quicker but even <kbd>Meta<\/kbd>+<kbd>x<\/kbd> can be fast if you have some sort of command completion engine such as <a href=\"https:\/\/github.com\/abo-abo\/swiper\">Ivy<\/a> installed. It&rsquo;s likely that the optimal solution is highly dependent on the user so there&rsquo;s probably no &ldquo;good&rdquo; answer that everyone should employ.\n<\/p>\n<p>\nI don&rsquo;t have an overarching strategy. I simply make the choice on a case-by-case basis. What do you do?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Over at the Emacs subreddit, domsch1988 has an interesting question: Is it better to use key shortcuts or Meta+x? The question is not as silly as it seems. Domsch1988 acknowledges that sometimes the choice is obvious. No one, for example, &hellip; <a href=\"https:\/\/irreal.org\/blog\/?p=12145\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[18],"class_list":["post-12145","post","type-post","status-publish","format-standard","hentry","category-general","tag-emacs"],"_links":{"self":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/12145","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=12145"}],"version-history":[{"count":1,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/12145\/revisions"}],"predecessor-version":[{"id":12146,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/12145\/revisions\/12146"}],"wp:attachment":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=12145"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=12145"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=12145"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}