[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/09/16 16:07 (UTC)] – [What is Emacs?] added original content and formatting mfillpot | 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 42: | Line 42: | ||
currently using. | currently using. | ||
===== Starting Out ===== | ===== 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 ===== | ===== 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 ===== | ===== 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 ===== | ===== Calling Functions ===== | ||
- | ===== Emacs Cheat Sheet ===== | ||
+ | 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: | ||
- | While [[slackbook: | + | **M-x** end-of-line <key>Enter</ |
- | 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 (many come with the program' | + | And the cursor would move to the end of the line, as the function name |
+ | suggests. | ||
+ | ===== Emacs Cheat Sheet ===== | ||
+ | |||
+ | While Emacs can be simple | ||
+ | overwhelming. | ||
+ | aspects have been simplified, most notably regarding text | ||
+ | selection. | ||
+ | **// | ||
+ | tutorials. | ||
+ | searches. | ||
- | 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. | ||
+ | **Emacs Cheat Sheet** | ||
+ | ^Command^Result| | ||
+ | |< | ||
+ | |< | ||
+ | |< | ||
+ | |< | ||
+ | |< | ||
+ | |< | ||
+ | |< | ||
+ | |< | ||
+ | |M-< | ||
+ | |< | ||
+ | |M-< | ||
+ | |M-< | ||
+ | |< | ||
+ | |M-< | ||
+ | |M-< | ||
+ | |M-< | ||
+ | |M-< | ||
+ | |< | ||
+ | |< | ||
+ | |< | ||
+ | |M-< | ||
+ | |C-< | ||
+ | |< | ||
+ | |< | ||
+ | |< | ||
+ | |< | ||
+ | |M-< | ||
+ | |< | ||
+ | |< | ||
+ | |< | ||
===== Starting Emacs ===== | ===== Starting Emacs ===== | ||