You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
3.4 KiB

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1">
  6. <link rel="icon" type="image/png" href="/favicon.ico">
  7. <link rel="canonical" href="https://www.mcmillen.dev/blog/20070522-emacs-tips.html">
  8. <link rel="alternate" type="application/atom+xml" href="https://www.mcmillen.dev/feed.atom" title="Colin McMillen's Blog - Atom">
  9. <title>Emacs Tips | Colin McMillen</title>
  10. <link rel="preconnect" href="https://fonts.gstatic.com">
  11. <link href="https://fonts.googleapis.com/css2?family=Quicksand:wght@500;700&display=block" rel="stylesheet">
  12. <link href="https://fonts.googleapis.com/css?family=Fira+Mono:500&display=block" rel="stylesheet">
  13. <link rel="stylesheet" href="/pygments.css">
  14. <link rel="stylesheet" href="/style.css">
  15. </head>
  16. <body>
  17. <div id="page-container">
  18. <div id="content-wrap">
  19. <div id="header">
  20. <div class="content">
  21. <a href="/" class="undecorated">Colin McMillen</a>
  22. <span style="float: right;"><a href="/feed.atom"><img src="/img/rss.svg" alt="Atom feed" style="width: 17px; height: 17px; margin-bottom: 1px;"></a></span>
  23. <span style="float: right;"><a href="https://twitter.com/mcmillen"><img src="/img/twitter.svg" alt="@mcmillen"></a></span>
  24. </div>
  25. </div>
  26. <div class="content">
  27. <h1 id="emacs-tips">Emacs Tips</h1>
  28. <p><em>Posted 2007-05-22, updated 2021-07-01.</em></p>
  29. <p>These are some emacs keybindings (and other functions) that I once found useful. I&rsquo;ve mostly used Sublime Text for the last few years, however.</p>
  30. <h2 id="editing">Editing</h2>
  31. <p><code>C-[SPC]</code>: set mark<br>
  32. <code>C-x C-x</code>: exchange point and mark<br>
  33. <code>C-w</code>: kill (AKA &ldquo;cut&rdquo;)<br>
  34. <code>M-w</code>: kill-ring-save (AKA &ldquo;copy&rdquo;)<br>
  35. <code>C-y</code>: yank (AKA &ldquo;paste&rdquo;)<br>
  36. <code>M-h</code>: Put region around current paragraph (mark-paragraph).<br>
  37. <code>C-x h</code>: Put region around the entire buffer (mark-whole-buffer).<br>
  38. <code>C-u C-[SPC]</code>: Move in mark ring<br>
  39. <code>M-d</code>: Kill word<br>
  40. <code>M-[DEL]</code>: Kill word backwards<br>
  41. <code>C-M-k</code>: Kill the following balanced expression (kill-sexp)</p>
  42. <h2 id="registers">Registers</h2>
  43. <p><code>C-x r r</code>: Save position of point in register r (point-to-register).<br>
  44. <code>C-x r j r</code>: Jump to the position saved in register r (jump-to-register).<br>
  45. <code>C-x r s r</code>: Copy region into register r (copy-to-register).<br>
  46. <code>C-x r i r</code>: Insert text from register r (insert-register).</p>
  47. <h2 id="bookmarks">Bookmarks</h2>
  48. <p><code>C-x r m [RET]</code>: Set the bookmark for the visited file, at point.<br>
  49. <code>C-x r m bookmark [RET]</code>: Set the bookmark named bookmark at point (bookmark-set).<br>
  50. <code>C-x r b bookmark [RET]</code>: Jump to the bookmark named bookmark (bookmark-jump).<br>
  51. <code>C-x r l</code>: List all bookmarks (list-bookmarks).<br>
  52. <code>M-x bookmark-save</code>: Save all the current bookmark values in the default bookmark file.</p>
  53. <h2 id="miscellaneous">Miscellaneous</h2>
  54. <p><code>M-`</code> shows the menu.<br>
  55. <code>M-x highlight-changes-mode</code> toggles showing the changes you&rsquo;ve made to the file since the last save.</p>
  56. </div>
  57. </div>
  58. <div id="footer">
  59. <div class="content">
  60. &copy; 2021 <a href="/" class="undecorated">Colin McMillen</a>. No cookies, no tracking.
  61. </div>
  62. </div>
  63. </div>
  64. </body>
  65. </html>