⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 http:^^www.cs.washington.edu^education^courses^341^spring96^help^emacs.html

📁 This data set contains WWW-pages collected from computer science departments of various universities
💻 HTML
📖 第 1 页 / 共 2 页
字号:
(and so much easier, since you don't have to go to the mouse all thetime) that I usually forget the menus are there.  Lots of the thingsthat I'm about to explain to you are bound to be in the menus as well,but I don't know for sure.  Anyway, play along with me, and as youread, you can check to see if they exist.  Then you can ignore all ofthe control-key sequences I'm about to tell you.<p><h3>Reading and Writing Files</h3>I think of emacs as being primarily an editor.  To load a file fromdisk or start editing a new file, use <b>C-x C-f</b> (find file).  Inthe minibuffer, you'll be prompted for a filename.  If it exists, itwill be loaded.  Otherwise, it'll create a new file for you.  Ifyou're not sure of the filename, you can hit SPACE at any time to geta list of files which match what you've typed up to that point.  Oruse TAB for file completion.<p>To save a file, use <b>C-x C-s</b>.  If there have been any changes,the file will be written to disk.  To save it under a differentfilename, use <b>C-x C-w</b> (write file).  You'll be prompted for anew name, and the buffer will be renamed (although the original filewill still exist on disk).<p><h3>Moving Around</h3>Most of the time, you can move the emacs cursor around using the arrowkeys or mouse.  Sometimes, however, they won't work, and you'll haveto use the keys: <b>C-f</b>, <b>C-b</b>, <b>C-p</b>, <b>C-n</b> tomove forwards, back, to the previous line, and to the next line,respectively.<p>To jump to the beginning of a screen line use <b>C-a</b> (First letterin the alphabet).  To jump to the end of the line, use <b>C-e</b>.<p>To move more quickly, use <b>C-v</b> to move down a screenful, and<b>M-v</b> to move up a screenful.  Use <b>C-&lt;</b> to move to thebeginning of a buffer and <b>C-&gt;</b> to move to the end.<p>I never use these, but to get really fine-grained you can use<b>C-{</b> to move up a paragraph and <b>C-}</b> to move down aparagraph; <b>M-a</b> to move to the beginning of the previoussentence and <b>M-e</b> to move to the end of the next sentence.<b>M-b</b> to move back a word and <b>M-f</b> to move forward a word(Or <b>M-left</b> and <b>M-right</b>).  Picky picky.<p><h3>Marking a Region</h3>If you can use a mouse with emacs, you can mark a region of text theway you would on any system:  clicking and dragging.  The highlighttends to disappear after you let go of the button, but the region will still be marked.<p>Otherwise, you have to mark the region by moving to one end of it andhitting <b>C-SPACE</b>.  Emacs will respond with "Mark set".  Thenmove to the other end and do whatever operation you want.  <b>This ispretty important:</b> emacs always has a notion of where the last markwas set (lots of operations set "the mark" wherever the cursor waswhen the operation was initiated).  Thus, it always has a notion ofthe current region: namely, everything between "the mark" and yourcursor.  This can be a problem if you accidentally hit "delete" forexample, because half of your file will disappear without youunderstanding why.  Thank goodness for undo. (read on...)<p><h3>Cutting, Copying, and Pasting</b>One way to cut text in emacs is to use <b>C-k</b> (kill).  I may bealone in this, but it's the only way I cut text.  <b>C-k</b> takes outthe text between the cursor and the end of the line.  If there is notext, then it takes out the linefeed and moves the next line up.Lines that you kill accumulate to be pasted.<p>A more conventional way of cutting would be to highlight and use<b>C-w</b> (wipe out).  If you're on a machine where you can't use amouse, set the region as described above.<p>Pasting is done using <b>C-y</b> (yank).<p>Copying can be done in the X windows way: namely, highlight a regionwith the mouse and then click the middle mouse button to paste.  Oryou can use <b>M-w</b>.<h3>Undoing</h3>Emacs has a phenomenal undo feature: <b>C-x u</b>.  You can undo untilyour fingers turn blue, slowly undoing lots and lots of recentkeystrokes, commands, and what-have-you.  It remembers quite a lot ofwhat you've recently done.<p><h3>Working with Buffers</h3>When you start emacs up, you'll typically only see one buffer and theminibuffer.  You can view multiple buffers at once, however, and thiscan be useful for viewing multiple files simultaneously.  <b>C-x 2</b>will divide a buffer window in half vertically giving you two buffers,each with their own status bar.  Move between the buffers using <b>C-xC-o</b> or the mouse.  Similarly, you can cut a buffer horizontallyusing <b>C-x 3</b>.  When editing Lisp or ML, we recommend dividingyour window in this way so that you can edit in one and run theinterpreter in the second.<p>To hide the buffer your cursor's in, use <b>C-x 0</b>.  Or to make thebuffer your cursor's in fill up the whole window again, use <b>C-x1</b>.<p>To view all the buffers in an emacs session, use <b>C-x C-b</b>.  Toswitch to a different buffer, use <b>C-x b</b> and emacs will promptyou for its name.<p>Normally when you are not viewing a buffer, it's still there thoughit's not visible.  To really drop one from your emacs session, use<b>C-x k</b> and supply the name.  If it's modified, emacs will checkwith you before killing it.  This can be useful if you need to get ridof a bunch of changes to a file.<p>You'll notice that emacs uses buffers to report information to you.These are typically surrounded with *'s to show that they don't havefiles associated with them.  You can switch between them or kill themjust like any other buffer.<p><h3>Functions/Key Bindings</h3>Most every function in emacs is implemented somewhere using a Lisproutine.  The common routines are bound to Control- and Meta- keysequences as we've been describing.  Emacs lets you bind any functionto any key sequence, which is part of the way in which it's socustomizable.  For example, in preparation for working with Lisp andML, we've bound some of the most common functions to keys (detailedelsewhere).<p>You can also call functions that are unbound by using <b>M-x</b>.This allows you to type the name of the function, which will then beexecuted.  For example, <b>C-v</b> is bound to the "scroll-up"function.  You could therefore also scroll up using <b>M-xscroll-up</b>.<p><h3>Searching/Replacing</h3>To search forward for a string, use <b>C-s</b>.  To search backwards(reverse), use <b>C-r</b>.<p>To replace all occurrences of a string in a buffer, use <b>M-xreplace-string</b>.  To replace some instances of a string, use <b>M-xquery-replace</b> and you'll be prompted at every location of thestring.<p><h3>On-line help</h3>Emacs has a lot of help available to you using <b>C-h</b>.  You canthen follow it with a single letter indicating what sort of help youwant.  <b>?</b> gives you a list of options.  <b>a</b> takes a stringand lists all the emacs functions related to that string.  <b>k</b>lets you type a key sequence, and explains briefly what function thatkey is bound to.  <b>f</b> lets you type the name of a function, andit will describe it in detail.  <b>m</b> gives you information aboutthe mode of the current buffer (e.g. Common Lisp mode, SML mode, etc.).<b>t</b> takes you through a tutorial which is somewhat poorly writtenin comparison with this document.  :)<p><h3>Conclusions</h3>That's about all I can think of right now.  Feel free to email me ifyou want to do something I haven't explained, or have other questions.I've put together a summary of the above information on a <!WA1><a href ="http://www.cs.washington.edu/education/courses/341/spring96/help/emacs.clip.html">Clip 'n' Save</a> page.<p><hr><address>Shamelessly stolen from cse341 Winter '96  <P>cse341-webmaster@cs.washington.edu</i>(Last update:		<!-- see man strftime for full formatting options-->	03/22/96 at 02PM)<i></address></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -