www-home/blog/20070522-emacs-tips.html

74 lines
3.4 KiB
HTML
Raw Normal View History

2021-07-01 22:34:24 +00:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/png" href="/favicon.ico">
<link rel="canonical" href="https://www.mcmillen.dev/blog/20070522-emacs-tips.html">
<link rel="alternate" type="application/atom+xml" href="https://www.mcmillen.dev/feed.atom" title="Colin McMillen's Blog - Atom">
<title>Emacs Tips | Colin McMillen</title>
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Quicksand:wght@500;700&display=block" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Fira+Mono:500&display=block" rel="stylesheet">
<link rel="stylesheet" href="/pygments.css">
<link rel="stylesheet" href="/style.css">
</head>
<body>
<div id="page-container">
<div id="content-wrap">
<div id="header">
<div class="content">
<a href="/" class="undecorated">Colin McMillen</a>
<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>
<span style="float: right;"><a href="https://twitter.com/mcmillen"><img src="/img/twitter.svg" alt="@mcmillen"></a></span>
</div>
</div>
<div class="content">
<h1 id="emacs-tips">Emacs Tips</h1>
<p><em>Posted 2007-05-22, updated 2021-07-01.</em></p>
<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>
<h2 id="editing">Editing</h2>
<p><code>C-[SPC]</code>: set mark<br>
<code>C-x C-x</code>: exchange point and mark<br>
<code>C-w</code>: kill (AKA &ldquo;cut&rdquo;)<br>
<code>M-w</code>: kill-ring-save (AKA &ldquo;copy&rdquo;)<br>
<code>C-y</code>: yank (AKA &ldquo;paste&rdquo;)<br>
<code>M-h</code>: Put region around current paragraph (mark-paragraph).<br>
<code>C-x h</code>: Put region around the entire buffer (mark-whole-buffer).<br>
<code>C-u C-[SPC]</code>: Move in mark ring<br>
<code>M-d</code>: Kill word<br>
<code>M-[DEL]</code>: Kill word backwards<br>
<code>C-M-k</code>: Kill the following balanced expression (kill-sexp)</p>
<h2 id="registers">Registers</h2>
<p><code>C-x r r</code>: Save position of point in register r (point-to-register).<br>
<code>C-x r j r</code>: Jump to the position saved in register r (jump-to-register).<br>
<code>C-x r s r</code>: Copy region into register r (copy-to-register).<br>
<code>C-x r i r</code>: Insert text from register r (insert-register).</p>
<h2 id="bookmarks">Bookmarks</h2>
<p><code>C-x r m [RET]</code>: Set the bookmark for the visited file, at point.<br>
<code>C-x r m bookmark [RET]</code>: Set the bookmark named bookmark at point (bookmark-set).<br>
<code>C-x r b bookmark [RET]</code>: Jump to the bookmark named bookmark (bookmark-jump).<br>
<code>C-x r l</code>: List all bookmarks (list-bookmarks).<br>
<code>M-x bookmark-save</code>: Save all the current bookmark values in the default bookmark file.</p>
<h2 id="miscellaneous">Miscellaneous</h2>
<p><code>M-`</code> shows the menu.<br>
<code>M-x highlight-changes-mode</code> toggles showing the changes you&rsquo;ve made to the file since the last save.</p>
</div>
</div>
<div id="footer">
<div class="content">
&copy; 2021 <a href="/" class="undecorated">Colin McMillen</a>. No cookies, no tracking.
</div>
</div>
</div>
</body>
</html>