?? ch07_01.htm
字號:
<html><head><title>The Emacs Editor (UNIX in a Nutshell: System V Edition)</title><link rel="stylesheet" type="text/css" href="../style/style1.css" /><meta name="DC.Creator" content="Arnold Robbins" /><meta name="DC.Format" content="text/xml" scheme="MIME" /><meta name="DC.Language" content="en-US" /><meta name="DC.Publisher" content="O'Reilly & Associates, Inc." /><meta name="DC.Source" scheme="ISBN" content="1-56592-427-4" /><meta name="DC.Subject.Keyword" content="stuff" /><meta name="DC.Title" content="UNIX in a Nutshell: System V Edition" /><meta name="DC.Type" content="Text.Monograph" /></head><body bgcolor="#ffffff"><img src="gifs/smbanner.gif" usemap="#banner-map" border="0" alt="Book Home" /><map name="banner-map"><area shape="rect" coords="1,-2,616,66" href="index.htm" alt="Book Title" /><area shape="rect" coords="629,-11,726,25" href="jobjects/fsearch.htm" alt="Search this book" /></map><div class="navbar"><table width="684" border="0"><tr><td align="left" valign="top" width="228"><a href="ch06_04.htm"><img src="../gifs/txtpreva.gif" alt="Previous" border="0" /></a></td><td align="center" valign="top" width="228" /><td align="right" valign="top" width="228"><a href="ch07_02.htm"><img src="../gifs/txtnexta.gif" alt="Next" border="0" /></a></td></tr></table></div><h1 class="chapter">Chapter 7. The Emacs Editor</h1><div class="htmltoc"><h4 class="tochead">Contents:</h4><p><a href="ch07_01.htm#sect1">Introduction</a><br /><a href="ch07_02.htm">Summary of Commands by Group</a><br /><a href="ch07_03.htm">Summary of Commands by Key</a><br /><a href="ch07_04.htm">Summary of Commands by Name</a><br /></p></div><p>This chapter presents the following topics:<a name="unut-ch-7-ix-emacs-editor" /></p><ul><li><p>Introduction</p></li><li><p>Summary of <tt class="literal">emacs</tt> commands by group</p></li><li><p>Summary of <tt class="literal">emacs</tt> commands by key</p></li><li><p>Summary of <tt class="literal">emacs</tt> commands by name</p></li></ul><p>For more information about <tt class="literal">emacs</tt>, see<em class="citetitle">Learning GNU Emacs</em>, listed in the <a href="biblio.htm">Bibliography</a>.</p><div class="sect1"><a name="unut-ch-7-sect-1" /><h2 class="sect1"><a name="sect1" />7.1. Introduction</h2><p>Although <tt class="literal">emacs</tt> is not part of SVR4 or Solaris,<a href="#FOOTNOTE-8">[8]</a>this text editor is found on many Unix systems becauseit is a popular alternative to <tt class="literal">vi</tt>.This book documentsGNU <tt class="literal">emacs</tt> (Version 20.3),which is available from the Free Software Foundation (<a href="http://www.gnu.org">http://www.gnu.org</a>).</p><blockquote class="footnote"><a name="FOOTNOTE-8" /><p> [8]The Sun Workshop programming environment, available separately from Sun,does come with Xemacs, a derivative of GNU <tt class="literal">emacs</tt>.</p></blockquote><p>To start an <tt class="literal">emacs</tt> editing session, type:</p><blockquote><pre class="code">emacs [<em class="replaceable"><tt>file</tt></em>]</pre></blockquote><p>On some systems, GNU <tt class="literal">emacs</tt> is invoked by typing <tt class="literal">gmacs</tt> instead of <tt class="literal">emacs</tt>.</p><a name="unut-ch-7-sect-1.1" /><div class="sect2"><h3 class="sect2">7.1.1. Notes on the Tables</h3><p><tt class="literal">emacs</tt> commands use the Control key and the Meta key(Meta is usually the Escape key).In this chapter, the notation <tt class="literal">C-</tt> indicates thatthe Control key is pressed at the same time as the character that follows.Similarly, <tt class="literal">M-</tt> indicates the use of the Meta key.When Meta is simulated by the Escape key,it's not necessary to keep the Meta key pressed down while typing the next key.But if your keyboard actually has a Meta key, then it is just likeControl or Shift, and you should press it simultaneously with theother key(s).</p><p>In the command tables that follow, the first column lists the keystroke and the last column describes it. When there is a middle column, it lists the command name. This name is accessed by typing<tt class="literal">M-x</tt> followed by the command name.If you're unsure of the name,you can type a space or a carriage return,and <tt class="literal">emacs</tt> lists possiblecompletions of what you've typed so far.</p><p>Because <tt class="literal">emacs</tt> is such a comprehensive editor, containing literally thousands of commands, some commandsmust be omitted for the sake of preserving a “quick” reference.You can browse the command set by typing <tt class="literal">C-h</tt>(for help) or<tt class="literal">M-x</tt> (for command names).</p></div><a name="unut-ch-7-sect-1.2" /><div class="sect2"><h3 class="sect2">7.1.2. Absolutely Essential Commands</h3><p>If you're just getting started with <tt class="literal">emacs</tt>,here's a short list ofthe most important commands:</p><table border="1" cellpadding="3"><tr><th><em class="emphasis">Keystrokes</em></th><th><em class="emphasis">Description</em></th></tr><tr><td>C-h</td><td><p>Enter the online help system.</p></td></tr><tr><td>C-x C-s</td><td><p>Save the file.</p></td></tr><tr><td>C-x C-c</td><td><p>Exit <tt class="literal">emacs</tt>.</p></td></tr><tr><td>C-x u</td><td><p>Undo last edit (can be repeated).</p></td></tr><tr><td>C-g</td><td><p>Get out of current command operation.</p></td></tr><tr><td><p>C-p</p><p>C-n</p><p>C-f</p><p>C-b</p></td><td><p>Up/down/forward/back by line or character.</p></td></tr><tr><td><p>C-v</p><p>M-v</p></td><td><p>Forward/backward by one screen.</p></td></tr><tr><td><p>C-s</p><p>C-r</p></td><td><p>Search forward/backward for characters.</p></td></tr><tr><td><p>C-d</p><p>Del</p></td><td><p>Delete next/previous character.</p></td></tr></table><p></div><a name="unut-ch-7-sect-1.3" /><div class="sect2"><h3 class="sect2">7.1.3. Typical Problems</h3><p>A very common problem is that the Del or Backspace key on the terminaldoes not delete the character before the cursor, as it should.Instead, it invokes a help prompt.This problem is caused by an incompatible terminal.A fairly robust fix is to create a file named <tt class="literal">.emacs</tt>in your home directory (or edit one that's already there) andadd the following lines:</p><blockquote><pre class="code">(keyboard-translate ?\C-h ?\C-?)(keyboard-translate ?\C-\\ ?\C-h)</pre></blockquote><p>Now the Del or Backspace key should work, and you can invoke help bypressing C-\ (an arbitrarily chosen key sequence).</p><p>Another problem that could happen when you are logged in from a remote terminalis that C-s may cause the terminal to hang.This is caused by an old-fashioned handshake protocol betweenthe terminal and the system.You can restart the terminal by pressing C-q, but that doesn't helpyou enter commands that contain the sequence C-s.The only solution (aside from using a more modern dial-inprotocol) is to create new key bindings that replace C-s.</p></div></div><hr width="684" align="left" /><div class="navbar"><table width="684" border="0"><tr><td align="left" valign="top" width="228"><a href="ch06_04.htm"><img src="../gifs/txtpreva.gif" alt="Previous" border="0" /></a></td><td align="center" valign="top" width="228"><a href="index.htm"><img src="../gifs/txthome.gif" alt="Home" border="0" /></a></td><td align="right" valign="top" width="228"><a href="ch07_02.htm"><img src="../gifs/txtnexta.gif" alt="Next" border="0" /></a></td></tr><tr><td align="left" valign="top" width="228">6.4. Examples of Searching</td><td align="center" valign="top" width="228"><a href="index/index.htm"><img src="../gifs/index.gif" alt="Book Index" border="0" /></a></td><td align="right" valign="top" width="228">7.2. Summary of Commands by Group</td></tr></table></div><hr width="684" align="left" /><img src="../gifs/navbar.gif" usemap="#library-map" border="0" alt="Library Navigation Links" /><p><p><font size="-1"><a href="copyrght.htm">Copyright © 2003</a> O'Reilly & Associates. All rights reserved.</font></p><map name="library-map"><area shape="rect" coords="1,0,88,96" href="../index.htm"><area shape="rect" coords="90,0,165,96" href="../upt/index.htm"><area shape="rect" coords="168,1,253,107" href="../mac/index.htm"><area shape="rect" coords="255,0,335,97" href="../korn/index.htm"><area shape="rect" coords="337,0,415,109" href="../unixnut/index.htm"><area shape="rect" coords="417,0,512,122" href="../sedawk/index.htm"><area shape="rect" coords="514,0,605,105" href="../lunix/index.htm"><area shape="rect" coords="611,2,694,121" href="../vi/index.htm"> </map></body></html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -