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