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