[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
slackbook:emacs [2012/08/22 02:33 (UTC)] – vharishankar | slackbook:emacs [2012/09/16 16:50 (UTC)] – [Emacs Cheat Sheet] **Emacs Cheat Sheet** ^Command^Result| |<key>C-f</key>|Move the cursor one character to the right (forward)| |<key>C-b</key>|Move the cursor one character to the left (backward)| |<key>C-n</key>|Move the cursor one line down (next)| |< mfillpot | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Emacs ====== | ====== Emacs ====== | ||
+ | ===== What is Emacs? ===== | ||
- | While [[slackbook: | + | **//vi//** and its clones |
+ | and powerful editors. | ||
+ | particularly extensible. | ||
+ | successful | ||
+ | **//vi//** variant that shrugs this trend, | ||
+ | being both extremely extensible | ||
+ | users prefer | ||
+ | many people (including the author of this chapter) prefer | ||
+ | **// | ||
- | Also unlike vi, which is an (excellent) editor and nothing more, emacs is a program with near endless capabilities. emacs is (for the most part) written in Lisp, which is a very powerful programming language that has the peculiar property that every program written in it is automatically a Lisp compiler of its own. This means that the user can extend emacs, and in fact write completely new programs "in emacs" | ||
- | As a result, emacs is not just an editor anymore. There are many add-on packages for emacs available | + | Emacs takes extensibility up to eleven. |
+ | the rest of **// | ||
+ | Lisp variant, nearly all of which is exposed to you, so that you | ||
+ | may configure it or even extend it at will (many good Emacs Lisp | ||
+ | tutorials can be found on the Internet). People have written | ||
+ | all sorts of extensions in Emacs Lisp, from syntax highlighting | ||
+ | for an obscure language, to a built-in terminal. In fact, | ||
+ | there's even a **//vi//** emulation mode | ||
+ | within **// | ||
+ | can still get the modal editing that comes with vi, while having | ||
+ | access to the power of the **// | ||
+ | core. | ||
- | There are two main versions of emacs: GNU Emacs (which is the version that comes with Slackware) and XEmacs. The latter is not a version for Emacs running under X. In fact, both emacs and XEmacs run on the console as well as under X. XEmacs was once started as a project to tidy up the emacs code. Currently, both versions are being actively developed, and there is in fact much interaction between the two development teams. For the present chapter, it is immaterial whether you use emacs or XEmacs, the differences between them are not relevant to the normal user. | ||
+ | Like **//vi//**, there are many variants of | ||
+ | **// | ||
+ | the one most commonly used (and the only one in Slackware) is | ||
+ | GNU Emacs. | ||
+ | always mean GNU Emacs. | ||
+ | |||
+ | |||
+ | Unlike **//vi//**, | ||
+ | **// | ||
+ | traditional editor by default. | ||
+ | shortcuts can be performed without repeatedly changing modes. | ||
+ | You can open up a file and start typing away without having to | ||
+ | learn what the modes do, or forgetting which one you are | ||
+ | currently using. | ||
+ | ===== Starting Out ===== | ||
+ | |||
+ | **// | ||
+ | running the **// | ||
+ | terminal. | ||
+ | you first start it in a console without arguments, you will see | ||
+ | something that resembles this: | ||
+ | |||
+ | | ||
+ | [[emacs-startup.png|Starting Out]] | ||
+ | |||
+ | If you are in X windows, **// | ||
+ | start a GUI instead of running in your console. | ||
+ | case and you don't want a GUI, you can invoke it with the flag | ||
+ | //' | ||
+ | |||
+ | |||
+ | While here, you can browse around using the | ||
+ | keyboard arrow keys. | ||
+ | Underlined elements are links, and you can activate them by | ||
+ | moving over them and pressing < | ||
+ | mentioned is very good, and can help you get your bearings | ||
+ | should you have any problems. | ||
+ | sequences such as < | ||
+ | < | ||
+ | key while holding down the < | ||
+ | with **M-`**, meaning to hold the the | ||
+ | **Meta** key (usually < | ||
+ | press the backtick < | ||
+ | the < | ||
+ | holding down the < | ||
+ | is also one of the more important commands in | ||
+ | **// | ||
+ | |||
+ | |||
+ | Alternatively, | ||
+ | file name as an argument, it will open that file, just like | ||
+ | **// | ||
+ | presented with the contents of the file in question. | ||
+ | navigate the document using traditional arrow keys and type in | ||
+ | information at will without any issues. | ||
+ | |||
+ | |||
+ | Say you make some edits, and you now want to save your file. | ||
+ | The following key sequence will do that: < | ||
+ | If you made a new file, you will be prompted for this in what is | ||
+ | called the //" | ||
+ | the bottom of the screen. | ||
+ | then hit < | ||
+ | save the file, you can press < | ||
+ | operations that ask for input. | ||
+ | usually available for operations that use the minibuffer. | ||
+ | |||
+ | |||
+ | Should you want to open a new file within your same | ||
+ | **// | ||
+ | minibuffer. | ||
+ | whether it exists or not. If it doesn' | ||
+ | will be created for it (the file will be created upon saving | ||
+ | with < | ||
+ | expected. | ||
+ | switch back to it using < | ||
+ | the file's name (or more technically, | ||
+ | hitting < | ||
+ | ===== How to Move Around ===== | ||
+ | |||
+ | Like **//vi//**, | ||
+ | **// | ||
+ | keys on your keyboard. | ||
+ | **//vi//**, using the arrow keys to navigate | ||
+ | files is also supported. | ||
+ | **//vi//** movement keys are more ergonomic, | ||
+ | **// | ||
+ | However, it is still very possible to operate using the main | ||
+ | **// | ||
+ | efficiently. | ||
+ | |||
+ | | ||
+ | **Emacs Cursor Movement** | ||
+ | ^Command^Result| | ||
+ | |< | ||
+ | |< | ||
+ | |< | ||
+ | |< | ||
+ | |||
+ | Of course, like with **//vi//** it is also | ||
+ | possible to repeat these commands with a numeric argument. | ||
+ | type in **M-1** **M-0** < | ||
+ | < | ||
+ | **M-5** < | ||
+ | will move five characters to the right. | ||
+ | ===== Getting Help ===== | ||
+ | |||
+ | **// | ||
+ | documentation, | ||
+ | //" | ||
+ | mechanisms for providing users with documentation while you are | ||
+ | using it. | ||
+ | |||
+ | Here are some useful functions that display documentation (they | ||
+ | all start with < | ||
+ | |||
+ | |||
+ | **Accessing Emacs Documentation** | ||
+ | ^Command^Result| | ||
+ | |< | ||
+ | |< | ||
+ | |< | ||
+ | |< | ||
+ | |||
+ | | ||
+ | < | ||
+ | ===== Calling Functions ===== | ||
+ | |||
+ | As noted earlier, **// | ||
+ | large number of functions to for interactive use. Some of | ||
+ | these, like those opening and saving files, are mapped to keys. | ||
+ | Others (like the ones for moving to the beginning and end of | ||
+ | lines) are not. To call them, you have to invoke them. Say we | ||
+ | want to call the function //" | ||
+ | this: | ||
+ | |||
+ | |||
+ | **M-x** end-of-line < | ||
+ | |||
+ | |||
+ | And the cursor would move to the end of the line, as the function name | ||
+ | suggests. | ||
+ | ===== Emacs Cheat Sheet ===== | ||
+ | |||
+ | While Emacs can be simple to use, its scope can easily be | ||
+ | overwhelming. | ||
+ | aspects have been simplified, most notably regarding text | ||
+ | selection. | ||
+ | **// | ||
+ | tutorials. | ||
+ | searches. | ||
+ | |||
+ | |||
+ | **Emacs Cheat Sheet** | ||
+ | ^Command^Result| | ||
+ | |< | ||
+ | |< | ||
+ | |< | ||
+ | |< | ||
+ | |< | ||
+ | |< | ||
+ | |< | ||
+ | |< | ||
+ | |M-< | ||
+ | |< | ||
+ | |M-< | ||
+ | |M-< | ||
+ | |< | ||
+ | |M-< | ||
+ | |M-< | ||
+ | |M-< | ||
+ | |M-< | ||
+ | |< | ||
+ | |< | ||
+ | |< | ||
+ | |M-< | ||
+ | |C-< | ||
+ | |< | ||
+ | |< | ||
+ | |< | ||
+ | |< | ||
+ | |M-< | ||
+ | |< | ||
+ | |< | ||
+ | |< | ||
===== Starting Emacs ===== | ===== Starting Emacs ===== | ||
Line 121: | Line 324: | ||
This quits emacs. If you have any unsaved files, emacs will tell you so, and ask if you want to save them each in turn. If you answer no to any of these, emacs will ask for one final confirmation and then quit. | This quits emacs. If you have any unsaved files, emacs will tell you so, and ask if you want to save them each in turn. If you answer no to any of these, emacs will ask for one final confirmation and then quit. | ||
- | =====Sources===== | + | ====== Chapter Navigation ====== |
- | + | ||
+ | **Previous Chapter: [[slackbook: | ||
+ | |||
+ | **Next Chapter: [[slackbook: | ||
+ | ======Sources====== | ||
* Original source: http:// | * Original source: http:// |