3 Micro has a plethora of hotkeys that make it easy and powerful to use and all
4 hotkeys are fully customizable to your liking.
6 Custom keybindings are stored internally in micro if changed with the `> bind`
7 command or you can also be added in the file `~/.config/micro/bindings.json` as
8 discussed below. For a list of the default keybindings in the json format used
9 by micro, please see the end of this file. For a more user-friendly list with
10 explanations of what the default hotkeys are and what they do, please see
13 If `~/.config/micro/bindings.json` does not exist, you can simply create it.
14 Micro will know what to do with it.
16 You can use the alt keys + arrows to move word by word. Ctrl left and right move
17 the cursor to the start and end of the line, and ctrl up and down move the
18 cursor the start and end of the buffer.
20 You can hold shift with all of these movement actions to select while moving.
25 The bindings may be rebound using the `~/.config/micro/bindings.json` file. Each
26 key is bound to an action.
28 For example, to bind `Ctrl-y` to undo and `Ctrl-z` to redo, you could put the
29 following in the `bindings.json` file.
38 In addition to editing your `~/.config/micro/bindings.json`, you can run
39 `>bind <keycombo> <action>` For a list of bindable actions, see below.
41 You can also chain commands when rebinding. For example, if you want Alt-s to
42 save and quit you can bind it like so:
51 ## Binding raw escape sequences
53 Only read this section if you are interested in binding keys that aren't on the
54 list of supported keys for binding.
56 One of the drawbacks of using a terminal-based editor is that the editor must
57 get all of its information about key events through the terminal. The terminal
58 sends these events in the form of escape sequences often (but not always)
61 For example, if micro reads `\x1b[1;5D`, on most terminals this will mean the
62 user pressed CtrlLeft.
64 For many key chords though, the terminal won't send any escape code or will send
65 an escape code already in use. For example for `CtrlBackspace`, my terminal
66 sends `\u007f` (note this doesn't start with `0x1b`), which it also sends for
67 `Backspace` meaning micro can't bind `CtrlBackspace`.
69 However, some terminals do allow you to bind keys to send specific escape
70 sequences you define. Then from micro you can directly bind those escape
71 sequences to actions. For example, to bind `CtrlBackspace` you can instruct your
72 terminal to send `\x1bctrlback` and then bind it in `bindings.json`:
76 "\u001bctrlback": "DeleteWordLeft"
80 Here are some instructions for sending raw escapes in different terminals
84 In iTerm2, you can do this in `Preferences->Profiles->Keys` then click the `+`,
85 input your keybinding, and for the `Action` select `Send Escape Sequence`. For
86 the above example your would type `ctrlback` into the box (the `\x1b`) is
87 automatically sent by iTerm2.
89 ### Linux using loadkeys
91 You can do this in linux using the loadkeys program.
98 It is also possible to disable any of the default key bindings by use of the
99 `UnbindKey` action in the user's `bindings.json` file.
102 ## Bindable actions and bindable keys
104 The list of default keybindings contains most of the possible actions and keys
105 which you can use, but not all of them. Here is a full list of both.
107 Full list of possible actions:
191 RemoveAllMultiCursors
196 You can also bind some mouse actions (these must be bound to mouse buttons)
203 Here is the list of all possible keys you can bind:
331 You can also bind some mouse buttons (they may be bound to normal actions or
344 # Default keybinding configuration.
349 "Down": "CursorDown",
350 "Right": "CursorRight",
351 "Left": "CursorLeft",
352 "ShiftUp": "SelectUp",
353 "ShiftDown": "SelectDown",
354 "ShiftLeft": "SelectLeft",
355 "ShiftRight": "SelectRight",
356 "AltLeft": "WordLeft",
357 "AltRight": "WordRight",
358 "AltUp": "MoveLinesUp",
359 "AltDown": "MoveLinesDown",
360 "AltShiftRight": "SelectWordRight",
361 "AltShiftLeft": "SelectWordLeft",
362 "CtrlLeft": "StartOfLine",
363 "CtrlRight": "EndOfLine",
364 "CtrlShiftLeft": "SelectToStartOfLine",
365 "ShiftHome": "SelectToStartOfLine",
366 "CtrlShiftRight": "SelectToEndOfLine",
367 "ShiftEnd": "SelectToEndOfLine",
368 "CtrlUp": "CursorStart",
369 "CtrlDown": "CursorEnd",
370 "CtrlShiftUp": "SelectToStart",
371 "CtrlShiftDown": "SelectToEnd",
372 "Alt-{": "ParagraphPrevious",
373 "Alt-}": "ParagraphNext",
374 "Enter": "InsertNewline",
375 "CtrlH": "Backspace",
376 "Backspace": "Backspace",
377 "Alt-CtrlH": "DeleteWordLeft",
378 "Alt-Backspace": "DeleteWordLeft",
379 "Tab": "IndentSelection,InsertTab",
380 "Backtab": "OutdentSelection,OutdentLine",
385 "CtrlP": "FindPrevious",
391 "CtrlD": "DuplicateLine",
393 "CtrlA": "SelectAll",
395 "Alt,": "PreviousTab",
397 "Home": "StartOfLine",
399 "CtrlHome": "CursorStart",
400 "CtrlEnd": "CursorEnd",
401 "PageUp": "CursorPageUp",
402 "PageDown": "CursorPageDown",
403 "CtrlG": "ToggleHelp",
404 "CtrlR": "ToggleRuler",
407 "CtrlB": "ShellMode",
409 "CtrlE": "CommandMode",
410 "CtrlW": "NextSplit",
411 "CtrlU": "ToggleMacro",
412 "CtrlJ": "PlayMacro",
414 // Emacs-style keybindings
415 "Alt-f": "WordRight",
417 "Alt-a": "StartOfLine",
418 "Alt-e": "EndOfLine",
420 // Integration with file managers
430 "MouseWheelUp": "ScrollUp",
431 "MouseWheelDown": "ScrollDown",
432 "MouseLeft": "MousePress",
433 "MouseMiddle": "PastePrimary",
434 "Ctrl-MouseLeft": "MouseMultiCursor",
436 // Multiple cursors bindings
437 "Alt-n": "SpawnMultiCursor",
438 "Alt-p": "RemoveMultiCursor",
439 "Alt-c": "RemoveAllMultiCursors",
440 "Alt-x": "SkipMultiCursor",
446 Note: On some old terminal emulators and on Windows machines, `CtrlH` should be
449 Additionally, alt keys can be bound by using `Alt-key`. For example `Alt-a` or
450 `Alt-Up`. Micro supports an optional `-` between modifiers like `Alt` and
451 `Ctrl` so `Alt-a` could be rewritten as `Alta` (case matters for alt bindings).
452 This is why in the default keybindings you can see `AltShiftLeft` instead of
453 `Alt-ShiftLeft` (they are equivalent).