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