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