]> git.lizzy.rs Git - micro.git/blob - runtime/help/keybindings.md
Fix comma and tabs in markdown help
[micro.git] / runtime / help / keybindings.md
1 # Keybindings
2
3 Here are the default keybindings in json form which is also how
4 you can rebind them to your liking.
5
6 ```json
7 {
8         "Up":             "CursorUp",
9         "Down":           "CursorDown",
10         "Right":          "CursorRight",
11         "Left":           "CursorLeft",
12         "ShiftUp":        "SelectUp",
13         "ShiftDown":      "SelectDown",
14         "ShiftLeft":      "SelectLeft",
15         "ShiftRight":     "SelectRight",
16         "AltLeft":        "WordLeft",
17         "AltRight":       "WordRight",
18         "AltShiftRight":  "SelectWordRight",
19         "AltShiftLeft":   "SelectWordLeft",
20         "CtrlLeft":       "StartOfLine",
21         "CtrlRight":      "EndOfLine",
22         "CtrlShiftLeft":  "SelectToStartOfLine",
23         "CtrlShiftRight": "SelectToEndOfLine",
24         "CtrlUp":         "CursorStart",
25         "CtrlDown":       "CursorEnd",
26         "CtrlShiftUp":    "SelectToStart",
27         "CtrlShiftDown":  "SelectToEnd",
28         "Enter":          "InsertEnter",
29         "Space":          "InsertSpace",
30         "Backspace":      "Backspace",
31         "Backspace2":     "Backspace",
32         "Alt-Backspace":  "DeleteWordLeft",
33         "Alt-Backspace2": "DeleteWordLeft",
34         "Tab":            "InsertTab,IndentSelection",
35         "CtrlO":          "OpenFile",
36         "CtrlS":          "Save",
37         "CtrlF":          "Find",
38         "CtrlN":          "FindNext",
39         "CtrlP":          "FindPrevious",
40         "CtrlZ":          "Undo",
41         "CtrlY":          "Redo",
42         "CtrlC":          "Copy",
43         "CtrlX":          "Cut",
44         "CtrlK":          "CutLine",
45         "CtrlD":          "DuplicateLine",
46         "CtrlV":          "Paste",
47         "CtrlA":          "SelectAll",
48         "CtrlT":          "AddTab",
49         "CtrlRightSq":    "PreviousTab",
50         "CtrlBackslash":  "NextTab",
51         "Home":           "Start",
52         "End":            "End",
53         "CtrlHome":       "CursorStart",
54         "CtrlEnd":        "CursorEnd",
55         "PageUp":         "CursorPageUp",
56         "PageDown":       "CursorPageDown",
57         "CtrlG":          "ToggleHelp",
58         "CtrlR":          "ToggleRuler",
59         "CtrlL":          "JumpLine",
60         "Delete":         "Delete",
61         "Esc":            "ClearStatus",
62         "CtrlB":          "ShellMode",
63         "CtrlQ":          "Quit",
64         "CtrlE":          "CommandMode",
65         "CtrlW":          "NextSplit",
66         "CtrlU":          "ToggleMacro",
67         "CtrlJ":          "PlayMacro",
68         
69         // Emacs-style keybindings
70         "Alt-f": "WordRight",
71         "Alt-b": "WordLeft",
72         "Alt-a": "StartOfLine",
73         "Alt-e": "EndOfLine",
74         "Alt-p": "CursorUp",
75         "Alt-n": "CursorDown",
76
77         // Integration with file managers
78         "F1": "ToggleHelp",
79         "F2": "Save",
80         "F4": "Quit",
81         "F7": "Find",
82         "F10": "Quit",
83         "Esc": "Quit",
84 }
85 ```
86
87 You can use the alt keys + arrows to move word by word.
88 Ctrl left and right move the cursor to the start and end of the line, and
89 ctrl up and down move the cursor the start and end of the buffer.
90
91 You can hold shift with all of these movement actions to select while moving.
92
93 # Rebinding keys
94
95 The bindings may be rebound using the `~/.config/micro/bindings.json`
96 file. Each key is bound to an action.
97
98 For example, to bind `Ctrl-y` to undo and `Ctrl-z` to redo, you could put the
99 following in the `bindings.json` file.
100
101 ```json
102 {
103         "CtrlY": "Undo",
104         "CtrlZ": "Redo"
105 }
106 ```
107
108 You can also chain commands when rebinding. For example, if you want Alt-s to save
109 and quit you can bind it like so:
110
111 ```json
112 {
113     "Alt-s": "Save,Quit"
114 }
115 ```
116
117 # Bindable actions and bindable keys
118
119 The list of default keybindings contains most of the possible actions and keys
120 which you can use, but not all of them. Here is a full list of both.
121
122 Full list of possible actions:
123
124 ```
125 CursorUp
126 CursorDown
127 CursorPageUp
128 CursorPageDown
129 CursorLeft
130 CursorRight
131 CursorStart
132 CursorEnd
133 SelectToStart
134 SelectToEnd
135 SelectUp
136 SelectDown
137 SelectLeft
138 SelectRight
139 WordRight
140 WordLeft
141 SelectWordRight
142 SelectWordLeft
143 DeleteWordRight
144 DeleteWordLeft
145 SelectToStartOfLine
146 SelectToEndOfLine
147 InsertNewline
148 InsertSpace
149 Backspace
150 Delete
151 Center
152 InsertTab
153 Save
154 Find
155 FindNext
156 FindPrevious
157 Undo
158 Redo
159 Copy
160 Cut
161 CutLine
162 DuplicateLine
163 DeleteLine
164 IndentSelection
165 OutdentSelection
166 Paste
167 SelectAll
168 OpenFile
169 Start
170 End
171 PageUp
172 PageDown
173 HalfPageUp
174 HalfPageDown
175 StartOfLine
176 EndOfLine
177 ToggleHelp
178 ToggleRuler
179 JumpLine
180 ClearStatus
181 ShellMode
182 CommandMode
183 Quit
184 QuitAll
185 AddTab
186 PreviousTab
187 NextTab
188 NextSplit
189 PreviousSplit
190 ToggleMacro
191 PlayMacro
192 ```
193
194 Here is the list of all possible keys you can bind:
195
196 ```
197 Up
198 Down
199 Right
200 Left
201 UpLeft
202 UpRight
203 DownLeft
204 DownRight
205 Center
206 PageUp
207 PageDown
208 Home
209 End
210 Insert
211 Delete
212 Help
213 Exit
214 Clear
215 Cancel
216 Print
217 Pause
218 Backtab
219 F1
220 F2
221 F3
222 F4
223 F5
224 F6
225 F7
226 F8
227 F9
228 F10
229 F11
230 F12
231 F13
232 F14
233 F15
234 F16
235 F17
236 F18
237 F19
238 F20
239 F21
240 F22
241 F23
242 F24
243 F25
244 F26
245 F27
246 F28
247 F29
248 F30
249 F31
250 F32
251 F33
252 F34
253 F35
254 F36
255 F37
256 F38
257 F39
258 F40
259 F41
260 F42
261 F43
262 F44
263 F45
264 F46
265 F47
266 F48
267 F49
268 F50
269 F51
270 F52
271 F53
272 F54
273 F55
274 F56
275 F57
276 F58
277 F59
278 F60
279 F61
280 F62
281 F63
282 F64
283 CtrlSpace
284 CtrlA
285 CtrlB
286 CtrlC
287 CtrlD
288 CtrlE
289 CtrlF
290 CtrlG
291 CtrlH
292 CtrlI
293 CtrlJ
294 CtrlK
295 CtrlL
296 CtrlM
297 CtrlN
298 CtrlO
299 CtrlP
300 CtrlQ
301 CtrlR
302 CtrlS
303 CtrlT
304 CtrlU
305 CtrlV
306 CtrlW
307 CtrlX
308 CtrlY
309 CtrlZ
310 CtrlLeftSq
311 CtrlBackslash
312 CtrlRightSq
313 CtrlCarat
314 CtrlUnderscore
315 Backspace
316 Tab
317 Esc
318 Escape
319 Enter
320 Backspace2
321 ```
322
323 Additionally, alt keys can be bound by using `Alt-key`. For example `Alt-a`
324 or `Alt-Up`. Micro supports an optional `-` between modifiers like `Alt` and `Ctrl`
325 so `Alt-a` could be rewritten as `Alta` (case matters for alt bindings). This is
326 why in the default keybindings you can see `AltShiftLeft` instead of `Alt-ShiftLeft` 
327 (they are equivalent).