]> git.lizzy.rs Git - micro.git/blob - runtime/help/keybindings.md
Add more documentation
[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 ```