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