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