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