slackware-current/slackbook/html/emacs-basic-editing.html
Patrick J Volkerding 75a4a592e5 Slackware 13.37
Mon Apr 25 13:37:00 UTC 2011
Slackware 13.37 x86_64 stable is released!

Thanks to everyone who pitched in on this release: the Slackware team,
the folks producing upstream code, and linuxquestions.org for providing
a great forum for collaboration and testing.

The ISOs are off to be replicated, a 6 CD-ROM 32-bit set and a
dual-sided
32-bit/64-bit x86/x86_64 DVD.  Please consider supporting the Slackware
project by picking up a copy from store.slackware.com.  We're taking
pre-orders now, and offer a discount if you sign up for a subscription.

As always, thanks to the Slackware community for testing, suggestions,
and feedback.  :-)

Have fun!
2018-05-31 22:45:18 +02:00

227 lines
7.1 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="generator" content="HTML Tidy, see www.w3.org" />
<title>Basic Editing</title>
<meta name="GENERATOR" content="Modular DocBook HTML Stylesheet Version 1.7" />
<link rel="HOME" title="Slackware Linux Essentials" href="index.html" />
<link rel="UP" title="Emacs" href="emacs.html" />
<link rel="PREVIOUS" title="Modes" href="emacs-modes.html" />
<link rel="NEXT" title="Saving Files" href="emacs-saving-files.html" />
<link rel="STYLESHEET" type="text/css" href="docbook.css" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body class="SECT1" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#840084"
alink="#0000FF">
<div class="NAVHEADER">
<table summary="Header navigation table" width="100%" border="0" cellpadding="0"
cellspacing="0">
<tr>
<th colspan="3" align="center">Slackware Linux Essentials</th>
</tr>
<tr>
<td width="10%" align="left" valign="bottom"><a href="emacs-modes.html"
accesskey="P">Prev</a></td>
<td width="80%" align="center" valign="bottom">Chapter 17 Emacs</td>
<td width="10%" align="right" valign="bottom"><a href="emacs-saving-files.html"
accesskey="N">Next</a></td>
</tr>
</table>
<hr align="LEFT" width="100%" />
</div>
<div class="SECT1">
<h1 class="SECT1"><a id="EMACS-BASIC-EDITING" name="EMACS-BASIC-EDITING">17.4 Basic
Editing</a></h1>
<p>When you have opened a file, you can of course move around in it with the cursor. The
<b class="KEYCAP">cursor keys</b> and <b class="KEYCAP">PgUp</b>, <b
class="KEYCAP">PgDn</b> do what you'd expect. <b class="KEYCAP">Home</b> and <b
class="KEYCAP">End</b> jump to the beginning and end of the line. (In older versions,
they would actually jump to the beginning and end of the buffer.) However, there are also
<b class="KEYCAP">Control</b> and <b class="KEYCAP">Meta</b> (<b class="KEYCAP">Alt</b>)
key combos that move the cursor around. Because you do not need to move your hands to
another part of the keyboard for these, they are much quicker once you get used to them.
The most important such commands are listed in <a
href="emacs-basic-editing.html#TABLE-EMACS-BASIC-EDITING">Table 17-1</a>.</p>
<div class="TABLE"><a id="TABLE-EMACS-BASIC-EDITING"
name="TABLE-EMACS-BASIC-EDITING"></a>
<p><b>Table 17-1. Basic Emacs Editing Commands</b></p>
<table border="0" frame="void" width="100%" class="CALSTABLE">
<col width="25%" />
<col width="75%" />
<thead>
<tr>
<th>Command</th>
<th>Result</th>
</tr>
</thead>
<tbody>
<tr>
<td><b class="KEYCAP">C</b>-<b class="KEYCAP">b</b> </td>
<td>go one character back</td>
</tr>
<tr>
<td><b class="KEYCAP">C</b>-<b class="KEYCAP">f</b> </td>
<td>go one character forward</td>
</tr>
<tr>
<td><b class="KEYCAP">C</b>-<b class="KEYCAP">n</b> </td>
<td>go one line down</td>
</tr>
<tr>
<td><b class="KEYCAP">C</b>-<b class="KEYCAP">p</b> </td>
<td>go one line up</td>
</tr>
<tr>
<td><b class="KEYCAP">C</b>-<b class="KEYCAP">a</b> </td>
<td>go to the beginning of the line</td>
</tr>
<tr>
<td><b class="KEYCAP">C</b>-<b class="KEYCAP">e</b> </td>
<td>go to the end of the line</td>
</tr>
<tr>
<td><b class="KEYCAP">M</b>-<b class="KEYCAP">b</b> </td>
<td>go one word back</td>
</tr>
<tr>
<td><b class="KEYCAP">M</b>-<b class="KEYCAP">f</b> </td>
<td>go one word forward</td>
</tr>
<tr>
<td><b class="KEYCAP">M</b>-<b class="KEYCAP">}</b> </td>
<td>go one paragraph forward</td>
</tr>
<tr>
<td><b class="KEYCAP">M</b>-<b class="KEYCAP">{</b> </td>
<td>go one paragraph backward</td>
</tr>
<tr>
<td><b class="KEYCAP">M</b>-<b class="KEYCAP">a</b> </td>
<td>go one sentence backward</td>
</tr>
<tr>
<td><b class="KEYCAP">M</b>-<b class="KEYCAP">e</b> </td>
<td>go one sentence forward</td>
</tr>
<tr>
<td><b class="KEYCAP">C</b>-<b class="KEYCAP">d</b> </td>
<td>delete the character under the cursor</td>
</tr>
<tr>
<td><b class="KEYCAP">M</b>-<b class="KEYCAP">d</b> </td>
<td>delete until the end of the current word</td>
</tr>
<tr>
<td><b class="KEYCAP">C</b>-<b class="KEYCAP">v</b> </td>
<td>go down one screen (i.e., PgDn)</td>
</tr>
<tr>
<td><b class="KEYCAP">M</b>-<b class="KEYCAP">v</b> </td>
<td>go up one screen (i.e., PgUp)</td>
</tr>
<tr>
<td><b class="KEYCAP">M</b>-<b class="KEYCAP">&lt;</b> </td>
<td>go to the beginning of the buffer</td>
</tr>
<tr>
<td><b class="KEYCAP">M</b>-<b class="KEYCAP">&gt;</b> </td>
<td>go to the end of the buffer</td>
</tr>
<tr>
<td><b class="KEYCAP">C</b>-<b class="KEYCAP">_</b> </td>
<td>undo the last change (can be repeated); note that you actually have to type <b
class="KEYCAP">Shift</b>+<b class="KEYCAP">Control</b>+<b class="KEYCAP">hyphen</b> for
this.</td>
</tr>
<tr>
<td><b class="KEYCAP">C</b>-<b class="KEYCAP">k</b> </td>
<td>delete to end of line</td>
</tr>
<tr>
<td><b class="KEYCAP">C</b>-<b class="KEYCAP">s</b> </td>
<td>forward search</td>
</tr>
<tr>
<td><b class="KEYCAP">C</b>-<b class="KEYCAP">r</b> </td>
<td>backward search</td>
</tr>
</tbody>
</table>
</div>
<p>Note that many <b class="KEYCAP">Meta</b> commands are parallel to the <b
class="KEYCAP">Control</b> commands except that they operate on larger units: while <b
class="KEYCAP">C</b>-<b class="KEYCAP">f</b> goes forward one character, <b
class="KEYCAP">M</b>-<b class="KEYCAP">f</b> goes forward an entire word, etc.</p>
<p>Also note that <b class="KEYCAP">M</b>-<b class="KEYCAP">&lt;</b> and <b
class="KEYCAP">M</b>-<b class="KEYCAP">&gt;</b> require you to type <b
class="KEYCAP">Shift</b>+<b class="KEYCAP">Alt</b>+<b class="KEYCAP">comma</b> and <b
class="KEYCAP">Shift</b>+<b class="KEYCAP">Alt</b>+<b class="KEYCAP">dot</b>
respectively, since <b class="KEYCAP">&lt;</b> and <b class="KEYCAP">&gt;</b> are on <b
class="KEYCAP">Shift</b>+<b class="KEYCAP">comma</b> and <b class="KEYCAP">Shift</b>+<b
class="KEYCAP">dot</b>. (Unless of course you have a different keyboard layout from the
standard US layout.)</p>
<p>Note that <b class="KEYCAP">C</b>-<b class="KEYCAP">k</b> deletes (kills, as it is
commonly called) all the text after the cursor to the end of the line, but doesn't delete
the line itself (i.e., it doesn't delete the final newline). It only deletes the line if
there was no text after the cursor. In other words, in order to delete a complete line,
you have to put the cursor at the beginning of the line, and then hit <b
class="KEYCAP">C</b>-<b class="KEYCAP">k</b> twice: once to delete the text on the line,
once to delete the line itself.</p>
</div>
<div class="NAVFOOTER">
<hr align="LEFT" width="100%" />
<table summary="Footer navigation table" width="100%" border="0" cellpadding="0"
cellspacing="0">
<tr>
<td width="33%" align="left" valign="top"><a href="emacs-modes.html"
accesskey="P">Prev</a></td>
<td width="34%" align="center" valign="top"><a href="index.html"
accesskey="H">Home</a></td>
<td width="33%" align="right" valign="top"><a href="emacs-saving-files.html"
accesskey="N">Next</a></td>
</tr>
<tr>
<td width="33%" align="left" valign="top">Modes</td>
<td width="34%" align="center" valign="top"><a href="emacs.html"
accesskey="U">Up</a></td>
<td width="33%" align="right" valign="top">Saving Files</td>
</tr>
</table>
</div>
</body>
</html>