-
Notifications
You must be signed in to change notification settings - Fork 10
/
readline-emacs-editing-mode-cheat-sheet.txt
256 lines (250 loc) · 19.3 KB
/
readline-emacs-editing-mode-cheat-sheet.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
.---------------------------------------------------------------------------.
| |
| Readline Emacs Editing Mode |
| Default Keyboard Shortcut |
| Cheat Sheet |
| |
'---------------------------------------------------------------------------'
| Peteris Krumins ([email protected]), 2007.10.30 |
| http://www.catonmat.net - good coders code, great reuse |
| |
| Released under the GNU Free Document License |
'---------------------------------------------------------------------------'
======================== Keyboard Shortcut Summary ========================
.--------------.-------------------.----------------------------------------.
| | | |
| Shortcut | Function | Description |
| | | |
'--------------'-------------------'----------------------------------------'
| Commands for Moving: |
'--------------.-------------------.----------------------------------------'
| C-a | beginning-of-line | Move to the beginning of line. |
'--------------+-------------------+----------------------------------------'
| C-e | end-of-line | Move to the end of line. |
'--------------+-------------------+----------------------------------------'
| C-f | forward-char | Move forward a character. |
'--------------+-------------------+----------------------------------------'
| C-b | backward-char | Move back a character. |
'--------------+-------------------+----------------------------------------'
| M-f | forward-word | Move forward a word. |
'--------------+-------------------+----------------------------------------'
| M-b | backward-word | Move backward a word. |
'--------------+-------------------+----------------------------------------'
| C-l | clear-screen | Clear the screen leaving the current |
| | | line at the top of the screen. |
'--------------+-------------------+----------------------------------------'
| (unbound) | redraw-current- | Refresh the current line. |
| | line | |
'--------------'-------------------'----------------------------------------'
| Commands for Changing Text: |
'--------------.-------------------.----------------------------------------'
| C-d | delete-char | Delete one character at point. |
'--------------+-------------------+----------------------------------------'
| Rubout | backward-delete- | Delete one character backward. |
| | char | |
'--------------+-------------------+----------------------------------------'
| C-q or C-v | quoted-insert | Quoted insert. |
'--------------+-------------------+----------------------------------------'
| M-TAB or | tab-insert | Insert a tab character. |
| M-C-i | | |
'--------------+-------------------+----------------------------------------'
| a, b, A, 1, | self-insert | Insert the character typed. |
| ... | | |
'--------------+-------------------+----------------------------------------'
| C-t | transpose-chars | Exchange the char before cursor with |
| | | the character at cursor. |
'--------------+-------------------+----------------------------------------'
| M-t | transpose-words | Exchange the word before cursor with |
| | | the word at cursor. |
'--------------+-------------------+----------------------------------------'
| M-u | upcase-word | Uppercase the current word. |
'--------------+-------------------+----------------------------------------'
| M-l | downcase-word | Lowercase the current word. |
'--------------+-------------------+----------------------------------------'
| M-c | capitalize-word | Capitalize the current word. |
'--------------+-------------------+----------------------------------------'
| (unbound) | overwrite-mode | Toggle overwrite mode. |
'--------------'-------------------'----------------------------------------'
| Killing and Yanking: |
'--------------.-------------------.----------------------------------------'
| C-k | kill-line | Kill the text from point to the end of |
| | | the line. |
'--------------+-------------------+----------------------------------------'
| C-x Rubout | backward-kill | Kill backward to the beginning of the |
| | -line | line. |
'--------------+-------------------+----------------------------------------'
| C-u | unix-line-discard | Kill backward from point to the |
| | | beginning of the line. |
'--------------+-------------------+----------------------------------------'
| M-d | kill-word | Kill from point to the end of the |
| | | current word. |
'--------------+-------------------+----------------------------------------'
| M-Rubout | backward-kill-word| Kill the word behind point. |
'--------------+-------------------+----------------------------------------'
| C-w | unix-word-rubout | Kill the word behind point, using |
| | | white space as a word boundary. |
'--------------+-------------------+----------------------------------------'
| M-\ | delete- | Delete all spaces and tabs around |
| | horizontal-space | point. |
'--------------+-------------------+----------------------------------------'
| C-y | yank | Yank the top of the kill ring into the |
| | | buffer at point. |
'--------------+-------------------+----------------------------------------'
| M-y | yank-pop | Rotate the kill ring, and yank the new |
| | | top |
'--------------+-------------------+----------------------------------------'
| (unbound) | kill-whole-line | Kill all characters on the current |
| | | line |
'--------------+-------------------+----------------------------------------'
| (unbound) | kill-region | Kill the text between the point and |
| | | mark. |
'--------------+-------------------+----------------------------------------'
| (unbound) | copy-region-as- | Copy the text in the region to the |
| | kill | kill buffer. |
'--------------+-------------------+----------------------------------------'
| (unbound) | copy-backward- | Copy the word before point to the kill |
| | word | buffer. |
'--------------+-------------------+----------------------------------------'
| (unbound) | copy-forward-word | Copy the word following point to the |
| | | kill buffer. |
'--------------'-------------------'----------------------------------------'
| Keyboard Macros: |
'--------------.-------------------.----------------------------------------'
| C-x ( | start-kbd-macro | Begin saving the chars typed into the |
| | | current keyboard macro. |
'--------------+-------------------+----------------------------------------'
| C-x ) | end-kbd-macro | End saving the chars typed into the |
| | | current keyboard macro. |
'--------------+-------------------+----------------------------------------'
| C-x e | call-last-kbd- | Re-execute the last keyboard macro |
| | macro | defined. |
'--------------'-------------------'----------------------------------------'
| Commands for Manipulating the History: |
'--------------.-------------------.----------------------------------------'
| Return | accept-line | Accept the line regardless of where |
| | | the cursor is. |
'--------------+-------------------+----------------------------------------'
| C-p | previous-history | Fetch the previous command from the |
| | | history list. |
'--------------+-------------------+----------------------------------------'
| C-n | next-history | Fetch the next command from the |
| | | history list. |
'--------------+-------------------+----------------------------------------'
| M-< | beginning-of- | Move to the first line in the history. |
| | history | |
'--------------+-------------------+----------------------------------------'
| M-> | end-of-history | Move to the end of the input history |
'--------------+-------------------+----------------------------------------'
| C-r | reverse-search- | Search backward starting at the |
| | history | current line (incremental). |
'--------------+-------------------+----------------------------------------'
| C-s | forward-search- | Search forward starting at the current |
| | history | line (incremental). |
'--------------+-------------------+----------------------------------------'
| M-p | non-incremental- | Search backward using non-incremental |
| | reverse-search- | search. |
| | history | |
'--------------+-------------------+----------------------------------------'
| M-n | non-incremental- | Search forward using non-incremental |
| | forward-search- | search. |
| | history | |
'--------------+-------------------+----------------------------------------'
| M-C-y | yank-nth-arg | Insert the n-th argument to the |
| | | previous command at point. |
'--------------+-------------------+----------------------------------------'
| M-. M-_ | yank-last-arg | Insert the last argument to the |
| | | previous command. |
'--------------+-------------------+----------------------------------------'
| (unbound) | history-search- | Search forward for a string between |
| | backward | start of line and point. |
'--------------+-------------------+----------------------------------------'
| (unbound) | history-search- | Search backward for a string between |
| | forward | start of line and point. |
'--------------'-------------------'----------------------------------------'
| Completing: |
'--------------.-------------------.----------------------------------------'
| TAB | complete | Attempt to perform completion on the |
| | | text before point. |
'--------------+-------------------+----------------------------------------'
| M-? | possible- | List the possible completions of the |
| | completions | text before point. |
'--------------+-------------------+----------------------------------------'
| M-* | insert- | Insert all completions of the text |
| | completions | before point generated by |
| | | possible-completions. |
'--------------+-------------------+----------------------------------------'
| (unbound) | menu-complete | Similar to complete but replaces the |
| | | word with the first match. |
'--------------+-------------------+----------------------------------------'
| (unbound) | delete-char-or- | Deletes the car if not at the |
| | list | beginning of line or acts like |
| | | possible-completions at the end of |
| | | the line. |
'--------------'-------------------'----------------------------------------'
| Miscellaneous: |
'--------------.-------------------.----------------------------------------'
| C-x C-r | re-read-init-file | Read and execute the contents of |
| | | inputrc file. |
'--------------+-------------------+----------------------------------------'
| C-g | abort | Abort the current editing command and |
| | | ring the terminal's bell. |
'--------------+-------------------+----------------------------------------'
| M-a, M-b, | do-uppercase- | If the metafield char 'x' is lowercase |
| M-x, ... | version | run the command that is bound to |
| | | uppercase char. |
'--------------+-------------------+----------------------------------------'
| ESC | prefix-meta | Metafy the next character typed. |
| | | For example, ESC-p is equivalent to |
| | | Meta-p |
'--------------+-------------------+----------------------------------------'
| C-_ or | undo | Incremental undo, separately |
| C-x C-u | | remembered for each line. |
'--------------+-------------------+----------------------------------------'
| M-r | revert-line | Undo all changes made to this line. |
'--------------+-------------------+----------------------------------------'
| M-& | tilde-expand | Perform tilde expansion on the current |
| | | word. |
'--------------+-------------------+----------------------------------------'
| C-@ or | set-mark | Set the mark to the point. |
| M-<space> | | |
'--------------+-------------------+----------------------------------------'
| C-x C-x | exchange-point- | Swap the point with the mark. |
| | and-mark | |
'--------------+-------------------+----------------------------------------'
| C-] | character-search | Move to the next occurance of current |
| | | character under cursor. |
'--------------+-------------------+----------------------------------------'
| M-C-] | character-search- | Move to the previous occurrence of |
| | backward | current character under cursor. |
'--------------+-------------------+----------------------------------------'
| M-# | insert-comment | Without argument line is commented, |
| | | with argument uncommented (if it was |
| | | commented). |
'--------------+-------------------+----------------------------------------'
| C-e | emacs-editing- | When in vi mode, switch to emacs mode. |
| | mode | |
'--------------+-------------------+----------------------------------------'
| M-C-j | vi-editing-mode | When in emacs mode, switch to vi mode. |
'--------------+-------------------+----------------------------------------'
| M-0, M-1, | digit-argument | Specify the digit to the argument. |
| ..., M-- | | M-- starts a negative argument. |
'--------------+-------------------+----------------------------------------'
| (unbound) | dump-functions | Print all of the functions and their |
| | | key bindings. |
'--------------+-------------------+----------------------------------------'
| (unbound) | dump-variables | Print all of the settable variables |
| | | and their values. |
'--------------+-------------------+----------------------------------------'
| (unbound) | dump-macros | Print all of the key sequences bound |
| | | to macros. |
'--------------+-------------------+----------------------------------------'
| (unbound) | universal- | Either sets argument or multiplies the |
| | argument | current argument by 4. |
'--------------'-------------------'----------------------------------------'
===========================================================================
.---------------------------------------------------------------------------.
| Peteris Krumins ([email protected]), 2007.10.30 |
| http://www.catonmat.net - good coders code, great reuse |
| |
| Released under the GNU Free Document License |
'---------------------------------------------------------------------------'