Add new attachment

Only authorized users are allowed to upload new attachments.

This page (revision-36) was last changed on 03-Mar-2017 14:49 by BlakeMcBride

This page was created on 27-Aug-2013 20:34 by BlakeMcBride

Only authorized users are allowed to rename pages.

Only authorized users are allowed to delete pages.

Difference between version and

At line 3 changed one line
The emacs editor
The emacs editor is perhaps the most powerful editor available. It runs under Unix, Linux, Macintosh, and Windows. It is highly customizable and programmable. Emacs comes with hundreds of modes and thousands of commands. The following list represents a tiny set of commands to help get you started.
At line 5 changed one line
!! Exiting Emacs
In what follows, "^x" would mean pressing the "x" key while the control key is held. "^x^f" would mean press "xf" while holding the control key down. "^xs" means press the "x" key while the control key is held, and then hit the "s" key after releasing the control key. The control key acts like the shift key in that it modifies the affect of the other key pressed.
At line 7 changed one line
| exit | ^X^C
In an effort to make things as difficult as possible, the Macintosh labels their keyboard differently from everyone else. The backspace (bksp) key is labeled "delete" on the Macintosh. They use fn-delete as a "del" key.
At line 9 added 15 lines
!!Glossary Of Terms
| file | file on the disk
| buffer | emacs' internal copy of a file to be edited
| window | a rectangular section of the display used to display an emacs buffer
| point | a spot between the two characters identified by the current cursor position and the character before it
| mark | a previously saved point (not necessarily the current point)
| region | a block of text between the mark and point
!! Exiting and Stopping Emacs
| ^x ^c | exit emacs
| ^g | abort the current function
At line 11 changed 4 lines
|^x ^f|read a file into emacs
|^x ^s|save a file
|^x s|save all files
|^x i|insert a file at current location
|^x ^f|read a file into a new emacs buffer
|^x ^s|save the buffer currently being edited to the original file
|^x s|save all modified buffers to their respective files
|^x i|insert a file at the current location (^x-eye)
At line 17 changed one line
!!Motion
!!Cursor Motion
At line 19 changed 2 lines
|^a | beginning of line
|^e | end of line
In addition to the normal motion commands using standard cursor keys (up, down, left, right, PgUp, PgDn, etc.) emacs also uses the following:
|^f | forward a character
|^b | back a character
|^n | next line
|^p | previous line
|^a | beginning of the line
|^e | end of the line
| ^right | forward a word
| ^left | backward a word
| ^down | next paragraph
| ^up | previous paragraph
At line 49 added 8 lines
!! Scrolling (screen motion)
|^v or PgDn|Scroll down
|Esc-v or PgUp|Scroll up
|Esc 0^l|Current line to top of screen (Esc zero Ctl-ell)
|Esc ^l|Current line to middle of screen (Esc Ctl-ell)
At line 26 changed one line
| ^d | delete character
| Del | delete the character the cursor is on
| bksp | delete the previous character
At line 28 changed one line
| Esc Del | delete previous word
| Esc bksp | delete previous word
At line 30 changed one line
| Ctl-Shft-Bksp | delete line
| Ctl-Shft-Bksp | delete the whole line
| Esc \ | delete all space and tab characters around the point
At line 67 added one line
!!Undoing
At line 69 added one line
If you make a mistake you can undo it with the following command. This command can be repeated to undo the prior command and so on back to the beginning of all of your edits.
At line 71 added 149 lines
| ^/ | undo edit
Consecutive undo's via consecutive ^/
To redo, type anything except a ^/ The following ^/ will redo.
!!Locations and Regions
The current position/location is considered the space between the location of the cursor and the previous character.
This is called the point. A point that is remembered is called a mark.
A region is between the last mark and the current cursor position (the point).
|^space | set mark here
|^x ^x | exchange point and mark
| ^u ^space | go to the previous mark
!!Cutting and Pasting
Unlike other editors, rather than a single cut / paste buffer where only a single item can be cut and paste at a time, emacs remembers all cuts and copies so that you can paste the last cut or any prior one.
| ^w | delete region and put on kill ring
| Esc w | copy region to kill ring
| ^y | yank back (paste) the last thing in the kill ring
| Esc y | replace last yank with prior region in the kill ring
!!Incremental Search
Incremental search differs from a typical search feature in that it starts the search with the first character and refines the search as you type each subsequent character in the search. This way one may find what one is looking for as soon as possible without typing any more characters than necessary.
| ^s | incremental search forward
| ^r | incremental search backward
| ^g | abort the search
| Esc-^s | incremental search forward with regular expressions
| Esc-^r | incremental search backward with regular expressions
^s and ^r can be used while searching in order to find the next occurrence.
Emacs's regular expression syntax corresponds to grep's extended regular expression syntax. See [grep]
!!Search and Replace
| Esc % | interactive search & replace
| Esc x query-replace-regexp | interactive search & replace utilizing regular expressions
The following valid responses are accepted during the interactive search and replace process.
| space | replace and find next
| bksp | no replace, find next
| ! | replace all remaining non-interactively
| ^ | go back to previous find
| , | replace current one and don't find next
| return | exit function
| ^r | recursive edit *
* recursive edit allows you to go back to a normal edit process. You then type "Esc ^c" to exist the recursive edit and return to the search and replace process.
!! Buffers
In general, buffers contain files being edited. Emacs can edit any number of files at a time. Emacs also supports multiple windows. Each window would display a particular buffer. Emacs can display any number of windows with any buffer (or the same buffer) at a time. In general, buffers have the same name as the file they hold.
Killing a buffer that contains changes to a file that you have not yet saved will cause the changes to be lost. However, emacs will warn you about this so that it doesn't happen accidentally.
| ^x b | select a different buffer to be displayed in the current window
| ^x ^b | list all buffers
| ^x 1 | delete the buffer list
| ^x k | kill a buffer
!!Multiple Windows
Window operations do not affect buffers. It only affects what is displayed. So, killing or creating windows does not affect files.
When you split the screen you will see two copies of the same file that may be navigated independently. Generally, after you split a window
you would place a different buffer (representing a different file) in the window by either utilizing a file command or buffer command.
| ^x 2 | split current window above and below
| ^x 3 | split window side-by-side
| ^x 1 | delete all other windows (doesn't hurt the buffers)
| ^x 0 | delete the current window (^x zero)
| ^x o | move cursor to the next (or other) window (^x oh)
!!Keyboard Macros
Emacs can remember a sequence of keys and emacs commands and be made to repeat them.
| ^x ( | start learning a sequence
| ^x ) | stop learning and remember the sequence as a macro
| ^x e | execute the last learned macro
| ^x^kbX | bind the last keyboard macro to the sequence ^x^kX (where X is any number or upper-case letter)
!!Repeating
All emacs command may be executed any number of times by preceding the command as follows:
| Esc N cmd | repeat command cmd N times
This is especially useful with keyboard macros in order to repeat a sequence many times.
!!Registers
Emacs has the ability to save and name any number of locations and text that has been cut or copied. Each location or block of text is saved in a register. Registers are simply variables with single character names. The name used is up to you. Emacs will ask you for the name.
| ^x r s | save marked region in a named register
| ^x r i | insert saved region into the current location
| ^x r space | save the current location in a named register
| ^x r j | jump to the location previously saved
!!Help
Emacs is fully documented. This documentation is available right with emacs.
| ^h i | info - access the embedded emacs manual
| ^h t | run the emacs tutorial
| ^h b | describe bindings - explain all current keyboard bindings
| ^h m | describe mode - explain all facilities for the current file type mode
Once viewing the manual, the following navigation commands are active.
| m enter | go to the menu item that you have placed the cursor on
| u | go up (back) to the previous menu level
| q | quit or exit the manual
| space | scroll forward a page
| bksp | scroll back a page
| . | top of current section
| n | next node (or section)
| p | previous node (or section)
!! Tags
Emacs comes with a program named “etags” that is used to create tag files.
Tag files are named “TAGS”
You can run etags in several directories producing one big tag file representing the whole project.
Usage: {{{etags [-o OUTFILE] [-a] *.c *.h}}}
| Esc-x visit-tags-table | read a TAGS file
| Esc-. | find tag
| ^u-Esc-. | find next tag
| Esc-* | go back to where tag was searched
| Esc-Tab | symbol completion
| ^x-^space | go back to previous location
Version Date Modified Size Author Changes ... Change note
36 03-Mar-2017 14:49 9.014 kB BlakeMcBride to previous
35 03-Mar-2017 14:48 9.025 kB BlakeMcBride to previous | to last
34 22-Jul-2016 23:43 9.023 kB BlakeMcBride to previous | to last
33 02-Mar-2016 15:01 8.504 kB BlakeMcBride to previous | to last
32 11-Feb-2015 13:38 8.506 kB BlakeMcBride to previous | to last
31 08-Dec-2013 17:31 8.45 kB BlakeMcBride to previous | to last
30 28-Nov-2013 13:34 8.361 kB BlakeMcBride to previous | to last
29 28-Nov-2013 13:22 8.253 kB BlakeMcBride to previous | to last
28 30-Oct-2013 11:22 8.035 kB BlakeMcBride to previous | to last
27 30-Oct-2013 11:08 7.88 kB BlakeMcBride to previous | to last
26 30-Oct-2013 11:05 7.788 kB BlakeMcBride to previous | to last
25 30-Oct-2013 10:52 7.777 kB BlakeMcBride to previous | to last
24 30-Oct-2013 10:26 7.68 kB BlakeMcBride to previous | to last
23 30-Sep-2013 17:07 7.338 kB BlakeMcBride to previous | to last
22 30-Sep-2013 17:02 7.232 kB BlakeMcBride to previous | to last
21 28-Aug-2013 17:41 7.101 kB BlakeMcBride to previous | to last
« This page (revision-36) was last changed on 03-Mar-2017 14:49 by BlakeMcBride