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:
52 You can also bind a key to execute a command in command mode (see
53 `help commands`). Simply prepend the binding with `command:`. For example:
57 "Alt-p": "command:pwd"
61 Now when you press `Alt-p` the `pwd` command will be executed which will show
62 your working directory in the infobar.
64 You can also bind an "editable" command with `command-edit:`. This means that
65 micro won't immediately execute the command when you press the binding, but
66 instead just place the string in the infobar in command mode. For example,
67 you could rebind `CtrlG` to `> help`:
71 "CtrlG": "command-edit:help "
75 Now when you press `CtrlG`, `help` will appear in the command bar and your cursor will
76 be placed after it (note the space in the json that controls the cursor placement).
78 ## Binding raw escape sequences
80 Only read this section if you are interested in binding keys that aren't on the
81 list of supported keys for binding.
83 One of the drawbacks of using a terminal-based editor is that the editor must
84 get all of its information about key events through the terminal. The terminal
85 sends these events in the form of escape sequences often (but not always)
88 For example, if micro reads `\x1b[1;5D`, on most terminals this will mean the
89 user pressed CtrlLeft.
91 For many key chords though, the terminal won't send any escape code or will send
92 an escape code already in use. For example for `CtrlBackspace`, my terminal
93 sends `\u007f` (note this doesn't start with `0x1b`), which it also sends for
94 `Backspace` meaning micro can't bind `CtrlBackspace`.
96 However, some terminals do allow you to bind keys to send specific escape
97 sequences you define. Then from micro you can directly bind those escape
98 sequences to actions. For example, to bind `CtrlBackspace` you can instruct your
99 terminal to send `\x1bctrlback` and then bind it in `bindings.json`:
103 "\u001bctrlback": "DeleteWordLeft"
107 Here are some instructions for sending raw escapes in different terminals
111 In iTerm2, you can do this in `Preferences->Profiles->Keys` then click the `+`,
112 input your keybinding, and for the `Action` select `Send Escape Sequence`. For
113 the above example your would type `ctrlback` into the box (the `\x1b`) is
114 automatically sent by iTerm2.
116 ### Linux using loadkeys
118 You can do this in linux using the loadkeys program.
125 It is also possible to disable any of the default key bindings by use of the
126 `UnbindKey` action in the user's `bindings.json` file.
129 ## Bindable actions and bindable keys
131 The list of default keybindings contains most of the possible actions and keys
132 which you can use, but not all of them. Here is a full list of both.
134 Full list of possible actions:
219 RemoveAllMultiCursors
225 You can also bind some mouse actions (these must be bound to mouse buttons)
232 Here is the list of all possible keys you can bind:
360 You can also bind some mouse buttons (they may be bound to normal actions or
373 # Default keybinding configuration.
378 "Down": "CursorDown",
379 "Right": "CursorRight",
380 "Left": "CursorLeft",
381 "ShiftUp": "SelectUp",
382 "ShiftDown": "SelectDown",
383 "ShiftLeft": "SelectLeft",
384 "ShiftRight": "SelectRight",
385 "AltLeft": "WordLeft",
386 "AltRight": "WordRight",
387 "AltUp": "MoveLinesUp",
388 "AltDown": "MoveLinesDown",
389 "AltShiftRight": "SelectWordRight",
390 "AltShiftLeft": "SelectWordLeft",
391 "CtrlLeft": "StartOfLine",
392 "CtrlRight": "EndOfLine",
393 "CtrlShiftLeft": "SelectToStartOfLine",
394 "ShiftHome": "SelectToStartOfLine",
395 "CtrlShiftRight": "SelectToEndOfLine",
396 "ShiftEnd": "SelectToEndOfLine",
397 "CtrlUp": "CursorStart",
398 "CtrlDown": "CursorEnd",
399 "CtrlShiftUp": "SelectToStart",
400 "CtrlShiftDown": "SelectToEnd",
401 "Alt-{": "ParagraphPrevious",
402 "Alt-}": "ParagraphNext",
403 "Enter": "InsertNewline",
404 "CtrlH": "Backspace",
405 "Backspace": "Backspace",
406 "Alt-CtrlH": "DeleteWordLeft",
407 "Alt-Backspace": "DeleteWordLeft",
408 "Tab": "IndentSelection,InsertTab",
409 "Backtab": "OutdentSelection,OutdentLine",
414 "CtrlP": "FindPrevious",
420 "CtrlD": "DuplicateLine",
422 "CtrlA": "SelectAll",
424 "Alt,": "PreviousTab",
426 "Home": "StartOfLine",
428 "CtrlHome": "CursorStart",
429 "CtrlEnd": "CursorEnd",
430 "PageUp": "CursorPageUp",
431 "PageDown": "CursorPageDown",
432 "CtrlG": "ToggleHelp",
433 "CtrlR": "ToggleRuler",
436 "CtrlB": "ShellMode",
438 "CtrlE": "CommandMode",
439 "CtrlW": "NextSplit",
440 "CtrlU": "ToggleMacro",
441 "CtrlJ": "PlayMacro",
443 // Emacs-style keybindings
444 "Alt-f": "WordRight",
446 "Alt-a": "StartOfLine",
447 "Alt-e": "EndOfLine",
449 // Integration with file managers
459 "MouseWheelUp": "ScrollUp",
460 "MouseWheelDown": "ScrollDown",
461 "MouseLeft": "MousePress",
462 "MouseMiddle": "PastePrimary",
463 "Ctrl-MouseLeft": "MouseMultiCursor",
465 // Multiple cursors bindings
466 "Alt-n": "SpawnMultiCursor",
467 "CtrlM": "SpawnMultiCursorSelect",
468 "Alt-p": "RemoveMultiCursor",
469 "Alt-c": "RemoveAllMultiCursors",
470 "Alt-x": "SkipMultiCursor",
476 Note: On some old terminal emulators and on Windows machines, `CtrlH` should be
479 Additionally, alt keys can be bound by using `Alt-key`. For example `Alt-a` or
480 `Alt-Up`. Micro supports an optional `-` between modifiers like `Alt` and
481 `Ctrl` so `Alt-a` could be rewritten as `Alta` (case matters for alt bindings).
482 This is why in the default keybindings you can see `AltShiftLeft` instead of
483 `Alt-ShiftLeft` (they are equivalent).