]> code.delx.au - dotemacs/blob - README_KEYBINDINGS.md
More keys for multiple cursors
[dotemacs] / README_KEYBINDINGS.md
1 # References
2 * [Reference Card](https://www.gnu.org/software/emacs/refcards/pdf/refcard.pdf)
3 * [Key Binding Conventions](https://www.gnu.org/software/emacs/manual/html_node/elisp/Key-Binding-Conventions.html)
4
5 # General commands
6 ```
7 C-x C-c Quit Emacs
8 C-u C-x C-c Save and quit
9 C-g Cancel command
10 C-/ Undo
11 C-g C-/ Undo undo
12 C-x z Repeat last command
13 M-x Execute command
14 M-: Evaluate expression as elisp
15 M-x eval-buffer Load current buffer as elisp
16 C-x C-0 Reset font to standard
17 C-x C-+/= Increase font size
18 C-x C-- Decrease font size
19 ```
20
21 # Help
22 ```
23 C-h C-h Help
24 C-h k Help about key binding
25 C-h v Describe variable
26 C-h f Describe function
27 C-h m Documentation on active modes
28 <prefix> C-h Show bindings starting with <prefix>
29 C-c C-b Back to previous help topic (while in help-mode)
30 q Quit window and bury buffer
31 ```
32
33 # Search
34 ```
35 C-s Search forward (ivy/swiper mode)
36 C-r Resume ivy search
37 C-7 Start a cursor for each result (while searching)
38 C-' Switch to avy jump mode
39 M-i Insert selected item (while searching)
40 M-q Replace searched item (while searching)
41 M-p Search for previous item (while searching)
42 M-n Search for symbol at point (while searching)
43 C-c C-o Dump all results into a buffer (ivy-occur)
44 C-c C-p Switch to wgrep mode
45 M-. Find thing at point
46 M-, Pop tag mark
47 ```
48
49 # Files/buffers
50 ```
51 C-x C-s Save current buffer
52 C-x s Save some buffers
53 C-x C-w Write buffer to file
54 C-x C-f Find file
55 C-x C-v Find file and kill current buffer
56 C-x f Find files in git repository
57 C-x g Grep in git repository
58 M-q Replace in git repository (while in git grep)
59 M-x find-file-at-point Find (open) filename at point
60 M-x browse-url-at-point Browse URL at point
61 C-x k Kill buffer
62 C-x c Clean up all buffers that are not visible
63 C-x b Select named buffer
64 C-x C-b Show all buffers
65 C-x C-r Show recent files
66 M-x scratch-buffer Create new scratch buffer
67 //,~ Go to {root,home} directory in find-file
68 ```
69
70 # Windows/frames
71 ```
72 C-x o Switch to other window
73 C-x 0 Delete window
74 C-x 1 Switch to single window
75 C-x 2 Split vertically
76 C-x 3 Split horizontally
77 C-x 9 Resize windows with arrow keys
78 C-x { / C-x } Shrink/enlarge window horizontally
79 C-Up / C-Down / C-Left / C-Right Switch windows
80 C-l Recenter display (center, top then bottom)
81 C-M-l Reposition window to contain useful text (eg entire defun)
82 C-x 5 2 New frame (X11 window)
83 ```
84
85 # Movement
86 ```
87 M-m Jump back to start of indentation
88 M-r Jump to window top/bottom/middle
89 M-g Tab Jump to column
90 M-g f Jump to charactor, ;/, to go forward/back
91 M-g g Jump to visible line or any line
92 M-g j Jump to word by first character
93 M-g M-g Jump to visible line or any line
94 C-a Beginning of line
95 C-e End of line
96 C-p Back one line
97 C-n Forward one line
98 C-b Back one character
99 C-n Forward one character
100 M-b Back a word
101 M-f Forward a word
102 M-a Backward sentence
103 M-e Forward sentence
104 M-v Back page
105 C-v Forward page
106 M-{ Back one paragraph
107 M-} Forward one paragraph
108 M-< Top of file
109 M-> End of file
110 C-M-p Back to start of balanced expression
111 C-M-n Forward to end of balanced expression
112 C-M-b Back one s-expression / symbol
113 C-M-f Forward one s-expression / symbol
114 C-M-u Move up one level of parentheses
115 ```
116
117 # Text formatting
118 ```
119 Tab Indent current line correctly
120 C-x Tab Indent region with left/right
121 M-/ Expand at point
122 M-Tab Auto-complete at point
123 M-; Comment line or region
124 M-i Change inner region
125 M-q Reformat paragraph
126 M-l Lower case word
127 M-u Upper case word
128 M-c Capitalise word
129 C-x C-l Lower case region
130 C-x C-u Upper case region
131 C-o Insert a new line above point
132 M-o Insert a new line below point
133 C-j Newline and maybe indent
134 M-^ Join to previous line
135 M-j New line with comment
136 C-q Quoted insert
137 C-M-\ Indent region
138 C-c c Copy line
139 C-c d Duplicate line
140 M-x comment-box Wrap region in comment box
141 ```
142
143 # Marking
144 ```
145 C-Space Set mark (start selection)
146 C-Space C-Space Set mark to point
147 C-u C-space Pop mark
148 C-x C-space Pop global mark
149 C-x C-x Exchange point and mark
150 C-M-h Highlight expression
151 M-@ Set mark at end of next word
152 C-= Expand region
153 M-= Display info about region
154 C-. Go to last edit
155 C-, Go to last edit reverse
156 ```
157
158 # Multiple cursors
159 ```
160 C-c m a Insert cursor at all matching points
161 C-c m l Insert extra cursor on all lines in region
162 C-c m m Ask to insert extra cursor at locations matching selected region
163 C-c m p Add cursor at previous text like region
164 C-c m n Add cursor at next text like region
165 ```
166
167 # Highlighting
168 ```
169 M-s h u Unhighlight regexp
170 M-s h . Highlight symbol at point
171 M-s h p Highlight phrase
172 M-s h r Highlight regexp
173 M-s h l Highlight lines matching regexp
174 ```
175
176 # Killing and deleting
177 ```
178 C-M-k Kill s-expression / symbol
179 C-w Kill from mark to point
180 C-y Yank text (paste)
181 M-y Scroll through kill ring (paste buffer)
182 M-z <char> Kill until <char>
183 C-k Kill to end of line
184 M-0 C-k Kill to beginning of line
185 C-c k Kill whole line
186 C-c s Copy line
187 C-d Delete next character
188 M-d Delete next word
189 M-Backspace Delete previous word
190 M-Space Collpase to one space around point
191 M-\ Delete spaces around point
192 C-x C-o Collapse blank lines
193 M-x delete-trailing-whitespace Delete trailing whitespace
194 ```
195
196 # Transposing
197 ```
198 C-t Transpose chars
199 M-t Transpose words
200 C-x C-t Transpose lines
201 C-M-t Transpose s-expressions
202 ```
203
204 # Rectangle
205 ```
206 C-x Space Toggle mark rectangle mode
207 C-x r t Replace rectangle with string
208 ```
209
210 # Macros
211 ```
212 F3 , F4 Start recording macro, finish recording macro
213 C-u F3 Play last macro then append keys
214 F4 Play back macro
215 C-x C-k b Bind macro to key (0-9, A-Z)
216 C-x C-k C-e Edit last macro
217 C-x C-k l Edit recent keys as macro
218 C-x C-k r Apply macro to region lines
219 ```
220
221 # Registers
222 ```
223 C-x r s <?> Copy region into register
224 C-x r i <?> Insert text from register
225 C-x r Space <?> Save point position to register
226 C-x r j <?> Jump to point position at register
227 ```
228
229 # Mouse secondary selection
230 ```
231 Meta-Drag Set selection
232 Meta-Right-Click Yank secondary
233 ```
234
235
236 # Mode switching
237 ```
238 C-x C-j Open direx at current file
239 F8 Toggle flyspell-mode
240 F9 Toggle whitespace mode
241 F10 Toggle word wrap
242 M-s o Search in buffer and display results in occur-mode
243 M-x multi-occur Search in buffers and display results in occur-mode
244 M-x eshell Run eshell
245 M-x ielm Run Emacs Lisp REPL
246 M-x linum-mode Display line numbers
247 M-x overwrite-mode Switch to overwrite mode
248 M-x shell Run bash shell
249 M-x slime Run Common Lisp REPL
250 M-x smerge-ediff Resolve merge conflicts in multi-window mode
251 M-x smerge-mode Resolve merge conflicts by hunks
252 M-x term Run terminal
253 M-x yas-reload-all Reload all snippets
254 ```
255
256 # Occur
257 ```
258 g Reload
259 e Switch to edit mode
260 C-c C-c Switch back to occur mode
261 M-g M-p Previous occurence
262 M-g M-n Next occurence
263 ```
264
265 # Magit / Git gutter
266 ```
267 C-c g d Popup diff
268 C-c g p Previous hunk
269 C-c g n Next hunk
270 C-c g r Revert hunk
271 C-c g s Magit status
272 C-c g f Magit file specific commands
273 C-c g g Magit dispatch popup
274 p Previous section
275 n Next section
276 M-p Previous sibling section
277 M-n Next sibling section
278 ^ Up section
279 Tab Toggle visibility of section
280 C-Tab Cycle visibility of section and its children
281 q Kill window and bury buffer
282 C-c C-c Perform action
283 C-c C-k Cancel action
284 ```
285
286 # Lisp
287 ```
288 C-M-x Eval top-level form
289 C-c C-z Switch to REPL
290 C-c C-c Compile and load the top-level form at point
291 C-c M-k Compile (but not load) the current buffer's file
292 ```
293
294
295 # Javascript
296 ```
297 C-c C-r Rename variable
298 C-c C-c Find type
299 C-c C-d Find docs
300 ```
301
302
303 # Shell
304 ```
305 M-! Execute command
306 M-& Execute command asynchronously
307 M-| Execute with region
308 C-u M-| Filter with region
309 ```
310
311 # Smerge mode
312 ```
313 C-c ^ p Go to previous hunk
314 C-c ^ n Go to next hunk
315 C-c ^ Return Keep current
316 C-c ^ a Keep all
317 C-c ^ m Keep mine
318 C-c ^ o Keep other
319 ```
320
321 # Flyspell
322 ```
323 M-$ Correct word
324 C-M-i Automatically correct word
325 C-; Automatically correct last word
326 <mouse-2> Popup word correction
327 ```
328
329 # Flycheck
330 ```
331 C-c ! v Verify setup
332 C-c ! n Next error
333 C-c ! p Previous error
334 C-c ! l List errors
335 C-c ! x Disable checker
336 ```