]> git.lizzy.rs Git - micro.git/blob - runtime/help/keybindings.md
44bf922ce6ed35024e843aafe52041531c84b6ec
[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 QuitAll
173 AddTab
174 PreviousTab
175 NextTab
176 NextSplit
177 PreviousSplit
178 ```
179
180 Here is the list of all possible keys you can bind:
181
182 ```
183 Up
184 Down
185 Right
186 Left
187 UpLeft
188 UpRight
189 DownLeft
190 DownRight
191 Center
192 PageUp
193 PageDown
194 Home
195 End
196 Insert
197 Delete
198 Help
199 Exit
200 Clear
201 Cancel
202 Print
203 Pause
204 Backtab
205 F1
206 F2
207 F3
208 F4
209 F5
210 F6
211 F7
212 F8
213 F9
214 F10
215 F11
216 F12
217 F13
218 F14
219 F15
220 F16
221 F17
222 F18
223 F19
224 F20
225 F21
226 F22
227 F23
228 F24
229 F25
230 F26
231 F27
232 F28
233 F29
234 F30
235 F31
236 F32
237 F33
238 F34
239 F35
240 F36
241 F37
242 F38
243 F39
244 F40
245 F41
246 F42
247 F43
248 F44
249 F45
250 F46
251 F47
252 F48
253 F49
254 F50
255 F51
256 F52
257 F53
258 F54
259 F55
260 F56
261 F57
262 F58
263 F59
264 F60
265 F61
266 F62
267 F63
268 F64
269 CtrlSpace
270 CtrlA
271 CtrlB
272 CtrlC
273 CtrlD
274 CtrlE
275 CtrlF
276 CtrlG
277 CtrlH
278 CtrlI
279 CtrlJ
280 CtrlK
281 CtrlL
282 CtrlM
283 CtrlN
284 CtrlO
285 CtrlP
286 CtrlQ
287 CtrlR
288 CtrlS
289 CtrlT
290 CtrlU
291 CtrlV
292 CtrlW
293 CtrlX
294 CtrlY
295 CtrlZ
296 CtrlLeftSq
297 CtrlBackslash
298 CtrlRightSq
299 CtrlCarat
300 CtrlUnderscore
301 Backspace
302 Tab
303 Esc
304 Escape
305 Enter
306 Backspace2
307 ```
308
309 Additionally, alt keys can be bound by using `Alt-key`. For example `Alt-a`
310 or `Alt-Up`. Micro supports an optional `-` between modifiers like `Alt` and `Ctrl`
311 so `Alt-a` could be rewritten as `Alta` (case matters for alt bindings). This is
312 why in the default keybindings you can see `AltShiftLeft` instead of `Alt-ShiftLeft` 
313 (they are equivalent).