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.

Page revision history

Version Date Modified Size Author Changes ... Change note
36 03-Mar-2017 14:49 8 KB BlakeMcBride to previous
35 03-Mar-2017 14:48 8 KB BlakeMcBride to previous | to last
34 22-Jul-2016 23:43 8 KB BlakeMcBride to previous | to last
33 02-Mar-2016 15:01 8 KB BlakeMcBride to previous | to last
32 11-Feb-2015 13:38 8 KB BlakeMcBride to previous | to last
31 08-Dec-2013 17:31 8 KB BlakeMcBride to previous | to last
30 28-Nov-2013 13:34 8 KB BlakeMcBride to previous | to last
29 28-Nov-2013 13:22 8 KB BlakeMcBride to previous | to last
28 30-Oct-2013 11:22 7 KB BlakeMcBride to previous | to last
27 30-Oct-2013 11:08 7 KB BlakeMcBride to previous | to last
26 30-Oct-2013 11:05 7 KB BlakeMcBride to previous | to last
25 30-Oct-2013 10:52 7 KB BlakeMcBride to previous | to last
24 30-Oct-2013 10:26 7 KB BlakeMcBride to previous | to last
23 30-Sep-2013 17:07 7 KB BlakeMcBride to previous | to last
22 30-Sep-2013 17:02 7 KB BlakeMcBride to previous | to last
21 28-Aug-2013 17:41 6 KB BlakeMcBride to previous | to last

Page References

Incoming links Outgoing links

Version management

Difference between version and

1!!!Emacs Editor
2
3The 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.
4The emacs editor
5
6In 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.
7!! Exiting Emacs
8
9In 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.
10| exit | ^X^C
11
12!!Glossary Of Terms
13
14| file | file on the disk
15| buffer | emacs' internal copy of a file to be edited
16| window | a rectangular section of the display used to display an emacs buffer
17| point | a spot between the two characters identified by the current cursor position and the character before it
18| mark | a previously saved point (not necessarily the current point)
19| region | a block of text between the mark and point
20
21
22!! Exiting and Stopping Emacs
23
24| ^x ^c | exit emacs
25| ^g | abort the current function
26
27!!Files
28
29|^x ^f|read a file into a new emacs buffer
30|^x ^s|save the buffer currently being edited to the original file
31|^x s|save all modified buffers to their respective files
32|^x i|insert a file at the current location (^x-eye)
33|^x ^f|read a file into emacs
34|^x ^s|save a file
35|^x s|save all files
36|^x i|insert a file at current location
37|^x ^w|write buffer to a named file
38
39!!Cursor Motion
40!!Motion
41
42In addition to the normal motion commands using standard cursor keys (up, down, left, right, PgUp, PgDn, etc.) emacs also uses the following:
43
44|^f | forward a character
45|^b | back a character
46|^n | next line
47|^p | previous line
48|^a | beginning of the line
49|^e | end of the line
50| ^right | forward a word
51| ^left | backward a word
52| ^down | next paragraph
53| ^up | previous paragraph
54|^a | beginning of line
55|^e | end of line
56|Esc < | beginning of buffer
57|Esc > | end of buffer
58
59!! Scrolling (screen motion)
60
61|^v or PgDn|Scroll down
62|Esc-v or PgUp|Scroll up
63|Esc 0^l|Current line to top of screen (Esc zero Ctl-ell)
64|Esc ^l|Current line to middle of screen (Esc Ctl-ell)
65
66
67!!Deleting
68
69| Del | delete the character the cursor is on
70| bksp | delete the previous character
71| ^d | delete character
72| Esc d | delete following word
73| Esc bksp | delete previous word
74| Esc Del | delete previous word
75| ^k | delete to end-of-line
76| Ctl-Shft-Bksp | delete the whole line
77| Esc \ | delete all space and tab characters around the point
78| Ctl-Shft-Bksp | delete line
79
80!!Undoing
81
82If 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.
83
84| ^/ | undo edit
85
86Consecutive undo's via consecutive ^/
87
88To redo, type anything except a ^/ The following ^/ will redo.
89
90!!Locations and Regions
91
92The current position/location is considered the space between the location of the cursor and the previous character.
93This is called the point. A point that is remembered is called a mark.
94A region is between the last mark and the current cursor position (the point).
95
96|^space | set mark here
97|^x ^x | exchange point and mark
98| ^u ^space | go to the previous mark
99| ^u ^space | go to previous mark
100
101!!Cutting and Pasting
102
103Unlike 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.
104Unlike other editors, rather than a single cut / paste buffer where only a single item can be cut and paste at a time,
105emacs remembers all cuts and copies so that you can paste the last cut or any prior one.
106
107| ^w | delete region and put on kill ring
108| Esc w | copy region to kill ring
109| ^y | yank back (paste) the last thing in the kill ring
110| Esc y | replace last yank with prior region in the kill ring
111| Esc y | replace last yank with prior thing in the kill ring
112
113!!Incremental Search
114
115Incremental 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.
116Incremental search differs from a typical search feature in that it starts the search with the first character and
117refines the search as you type each subsequent character in the search. This way one may find what one is looking for
118as soon as possible without typing any more characters than necessary.
119
120| ^s | incremental search forward
121| ^r | incremental search backward
122| ^g | abort the search
123| Esc-^s | incremental search forward with regular expressions
124| Esc-^r | incremental search backward with regular expressions
125| ^g | abort search
126
127
128^s and ^r can be used while searching in order to find the next occurrence.
129
130Emacs's regular expression syntax corresponds to grep's extended regular expression syntax. See [grep]
131
132!!Search and Replace
133
134| Esc % | interactive search & replace
135| Esc x query-replace-regexp | interactive search & replace utilizing regular expressions
136
137The following valid responses are accepted during the interactive search and replace process.
138
139| space | replace and find next
140| bksp | no replace, find next
141| del | no replace, find next
142| ! | replace all remaining non-interactively
143| ^ | go back to previous find
144| , | replace current one and don't find next
145| return | exit function
146| ^r | recursive edit *
147
148* 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.
149
150!! Buffers
151
152In 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.
153
154Killing 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.
155
156| ^x b | select a different buffer to be displayed in the current window
157| ^x ^b | list all buffers
158| ^x 1 | delete the buffer list
159| ^x k | kill a buffer
160
161!!Multiple Windows
162
163Window operations do not affect buffers. It only affects what is displayed. So, killing or creating windows does not affect files.
164
165When you split the screen you will see two copies of the same file that may be navigated independently. Generally, after you split a window
166you would place a different buffer (representing a different file) in the window by either utilizing a file command or buffer command.
167
168| ^x 2 | split current window above and below
169| ^x 3 | split window side-by-side
170| ^x 1 | delete all other windows (doesn't hurt the buffers)
171| ^x 0 | delete the current window (^x zero)
172| ^x o | move cursor to the next (or other) window (^x oh)
173
174!!Keyboard Macros
175
176Emacs can remember a sequence of keys and emacs commands and be made to repeat them.
177
178| ^x ( | start learning a sequence
179| ^x ) | stop learning and remember the sequence as a macro
180| ^x e | execute the last learned macro
181| ^x^kbX | bind the last keyboard macro to the sequence ^x^kX (where X is any number or upper-case letter)
182
183!!Repeating
184
185All emacs command may be executed any number of times by preceding the command as follows:
186
187| Esc N cmd | repeat command cmd N times
188
189This is especially useful with keyboard macros in order to repeat a sequence many times.
190
191!!Registers
192
193Emacs 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.
194
195| ^x r s | save marked region in a named register
196| ^x r i | insert saved region into the current location
197
198| ^x r space | save the current location in a named register
199| ^x r j | jump to the location previously saved
200
201
202!!Help
203
204Emacs is fully documented. This documentation is available right with emacs.
205
206| ^h i | info - access the embedded emacs manual
207| ^h t | run the emacs tutorial
208| ^h b | describe bindings - explain all current keyboard bindings
209| ^h m | describe mode - explain all facilities for the current file type mode
210
211Once viewing the manual, the following navigation commands are active.
212
213| m enter | go to the menu item that you have placed the cursor on
214| u | go up (back) to the previous menu level
215| q | quit or exit the manual
216| space | scroll forward a page
217| bksp | scroll back a page
218| . | top of current section
219| n | next node (or section)
220| p | previous node (or section)
221
222!! Tags
223
224Emacs comes with a program named “etags” that is used to create tag files.
225
226Tag files are named “TAGS”
227
228You can run etags in several directories producing one big tag file representing the whole project.
229
230
231Usage: {{{etags [-o OUTFILE] [-a] *.c *.h}}}
232
233
234| Esc-x visit-tags-table | read a TAGS file
235| Esc-. | find tag
236| ^u-Esc-. | find next tag
237| Esc-* | go back to where tag was searched
238| Esc-Tab | symbol completion
239
240| ^x-^space | go back to previous location
241