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