keskiviikko 18. maaliskuuta 2009

Emacs apuja

Hei taas, Laitan pienen pikaoppaan emacs:in aloitukseen.

Toistaiseksi englanniksi.Emacs on muuten todella hyvä ohjelma koodaamiseen, ja kaikkien pelkkää tekstiä sisältävien tiedostojen muokkaamiseen. Kirjoittelen myöhemmin sen hienoista puolista.

(Markku Åkerfelt @2009) Emacs Command Help * BASIC CURSOR CONTROL ---------------------- The following commands are useful for viewing screenfuls: C-v Move forward one screenful M-v Move backward one screenful C-l Clear screen and redisplay all the text, moving the text around the cursor to the center of the screen. (That's CONTROL-L, not CONTROL-1.) Here is a summary of simple cursor-moving operations, including the word and sentence moving commands: C-f Move forward a character C-b Move backward a character M-f Move forward a word M-b Move backward a word C-n Move to next line C-p Move to previous line C-a Move to beginning of line C-e Move to end of line M-a Move back to beginning of sentence M-e Move forward to end of sentence Two other important cursor motion commands are M-< (META Less-than), which moves to the beginning of the whole text, and M-> (META Greater-than), which moves to the end of the whole text repeat count is by typing C-u and then the digits before you type the command stop anything safely by typing C-g * WINDOWS --------- C-x 1 One window (i.e., kill all other windows). * INSERTING AND DELETING ------------------------ Delete the character just before the cursor C-d Delete the next character after the cursor M- Kill the word immediately before the cursor M-d Kill the next word after the cursor C-k Kill from the cursor position to end of line M-k Kill to the end of the current sentence The command for yanking is C-y. It reinserts the last killed text, at the current cursor position. C-_ is an alternative undo command; it works just the same as C-x u, but it is easier to type several times in a row. The disadvantage of C-_ is that on some keyboards it is not obvious how to type it. That is why we provide C-x u as well. On some terminals, you can type C-_ by typing / while holding down CONTROL. * FILES ------- C-x C-f Find a file C-x C-s Save the file * BUFFERS --------- C-x C-b List buffers Type C-x 1 to get rid of the buffer list Type C-x b foo to go back to the buffer "foo" C-x s Save some buffers `C-x b BUFFER ' Select or create a buffer named BUFFER (`switch-to-buffer'). `C-x 4 b BUFFER ' Similar, but select BUFFER in another window (`switch-to-buffer-other-window'). `C-x 5 b BUFFER ' Similar, but select BUFFER in a separate frame (`switch-to-buffer-other-frame'). `C-x ' Select the previous buffer in the list of existing buffers. `C-x ' Select the next buffer in the list of existing buffers. `C-u M-g M-g' `C-u M-g g' Read a number N and move to line N in the most recently selected buffer other than the current buffer. * EXTENDING THE COMMAND SET --------------------------- There are many, many more Emacs commands than could possibly be put on all the control and meta characters. Emacs gets around this with the X (eXtend) command. This comes in two flavors: C-x Character eXtend. Followed by one character. M-x Named command eXtend. Followed by a long name. C-z is the command to exit Emacs *temporarily* There are many C-x commands. Here is a list of the ones you have learned: C-x C-f Find file C-x C-s Save file C-x s Save some buffers C-x C-b List buffers C-x b Switch buffer C-x C-c Quit Emacs C-x 1 Delete all but one window C-x u Undo * AUTO SAVE ----------- writed #file M-x recover file * SEARCHING ----------- The command to initiate a search is C-s for forward search, and C-r for reverse search. * MULTIPLE WINDOWS ------------------ Move the cursor to this line and type C-u 0 C-l C-x 2 which splits the screen into two windows. Type C-M-v to scroll the bottom window. Type C-x o ("o" for "other") to move the cursor to the bottom window. Use C-v and M-v in the bottom window to scroll it. Type C-x o again to move the cursor back to the top window. `C-x 2' Split the selected window into two windows, one above the other (`split-window-vertically'). `C-x 3' Split the selected window into two windows positioned side by side (`split-window-horizontally'). `C-Mouse-2' In the mode line or scroll bar of a window, split that window C-x ^ Make selected window taller (enlarge-window). C-x } Make selected window wider (enlarge-window-horizontally). C-x { Make selected window narrower (shrink-window-horizontally). C-x - Shrink this window if its buffer doesn't need so many lines (shrink-window-if-larger-than-buffer). C-x + Make all windows the same height (balance-windows). Drag-Mouse-1 Dragging a window's mode line up or down with Mouse-1 changes window heights. Mouse-2 Mouse-2 in a window's mode line deletes all other windows in the frame (mouse-delete-other-windows). Mouse-3 Mouse-3 in a window's mode line deletes that window (mouse-delete-window). * HELP ------ C-h character C-h ? C-g to cancel it M-x help >> Type C-h c C-p. The message should be something like this: C-p runs the command previous-line To get more information about a command, use C-h k instead of C-h c C-h f Describe a function. You type in the name of the function. C-h a Command Apropos. Type in a keyword and Emacs will list all the commands whose names contain that keyword. These commands can all be invoked with META-x. For some commands, Command Apropos will also list a one or two character sequence which runs the same command. C-h i Read On-line Manuals (a.k.a. Info). This command puts you into a special buffer called `*info*' where you can read on-line manuals for the packages installed on your system. Type m emacs to read the Emacs manual. If you have never before used Info, type ? and Emacs will take you on a guided tour of Info mode facilities. Once you are through with this tutorial, you should consult the Emacs Info manual as your primary documentation. Type C-M-v to scroll the help window

Ei kommentteja:

Lähetä kommentti