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