]> git.lizzy.rs Git - micro.git/blob - runtime/help/help.md
Rebind Home and End to StartOfLine and EndOfLine
[micro.git] / runtime / help / help.md
1 # Micro help text
2
3 Micro is a terminal-based text editor that aims to be easy to use and intuitive, 
4 while also taking advantage of the full capabilities of modern terminals.
5
6 ### Usage
7
8 Once you have built the editor, simply start it by running 
9 `micro path/to/file.txt` or simply `micro` to open an empty buffer.
10
11 Micro also supports creating buffers from stdin:
12
13 ```
14 $ ifconfig | micro
15 ```
16
17 You can move the cursor around with the arrow keys and mouse.
18
19 ### Keybindings
20
21 Here are the default keybindings in json form which is also how
22 you can rebind them to your liking.
23
24 ```json
25 {
26         "Up":             "CursorUp",
27         "Down":           "CursorDown",
28         "Right":          "CursorRight",
29         "Left":           "CursorLeft",
30         "ShiftUp":        "SelectUp",
31         "ShiftDown":      "SelectDown",
32         "ShiftLeft":      "SelectLeft",
33         "ShiftRight":     "SelectRight",
34         "AltLeft":        "WordLeft",
35         "AltRight":       "WordRight",
36         "AltShiftRight":  "SelectWordRight",
37         "AltShiftLeft":   "SelectWordLeft",
38         "CtrlLeft":       "StartOfLine",
39         "CtrlRight":      "EndOfLine",
40         "CtrlShiftLeft":  "SelectToStartOfLine",
41         "CtrlShiftRight": "SelectToEndOfLine",
42         "CtrlUp":         "CursorStart",
43         "CtrlDown":       "CursorEnd",
44         "CtrlShiftUp":    "SelectToStart",
45         "CtrlShiftDown":  "SelectToEnd",
46         "Enter":          "InsertNewline",
47         "Space":          "InsertSpace",
48         "Backspace":      "Backspace",
49         "Backspace2":     "Backspace",
50         "Alt-Backspace":  "DeleteWordLeft",
51         "Alt-Backspace2": "DeleteWordLeft",
52         "Tab":            "IndentSelection,InsertTab",
53         "Backtab":        "OutdentSelection",
54         "CtrlO":          "OpenFile",
55         "CtrlS":          "Save",
56         "CtrlF":          "Find",
57         "CtrlN":          "FindNext",
58         "CtrlP":          "FindPrevious",
59         "CtrlZ":          "Undo",
60         "CtrlY":          "Redo",
61         "CtrlC":          "Copy",
62         "CtrlX":          "Cut",
63         "CtrlK":          "CutLine",
64         "CtrlD":          "DuplicateLine",
65         "CtrlV":          "Paste",
66         "CtrlA":          "SelectAll",
67         "CtrlT":          "AddTab",
68         "CtrlRightSq":    "PreviousTab",
69         "CtrlBackslash":  "NextTab",
70         "Home":           "StartOfLine",
71         "End":            "EndOfLine",
72         "PageUp":         "CursorPageUp",
73         "PageDown":       "CursorPageDown",
74         "CtrlG":          "ToggleHelp",
75         "CtrlR":          "ToggleRuler",
76         "CtrlL":          "JumpLine",
77         "Delete":         "Delete",
78         "Esc":            "ClearStatus",
79         "CtrlB":          "ShellMode",
80         "CtrlQ":          "Quit",
81         "CtrlE":          "CommandMode",
82         "CtrlW":          "NextSplit",
83
84         // Emacs-style keybindings
85         "Alt-f": "WordRight",
86         "Alt-b": "WordLeft",
87         "Alt-a": "StartOfLine",
88         "Alt-e": "EndOfLine",
89         "Alt-p": "CursorUp",
90         "Alt-n": "CursorDown",
91 }
92 ```
93
94 You can use the alt keys + arrows to move word by word.
95 Ctrl left and right move the cursor to the start and end of the line, and
96 ctrl up and down move the cursor the start and end of the buffer.
97
98 You can hold shift with all of these movement actions to select while moving.
99
100 The bindings may be rebound using the `~/.config/micro/bindings.json`
101 file. Each key is bound to an action.
102
103 For example, to bind `Ctrl-y` to undo and `Ctrl-z` to redo, you could put the
104 following in the `bindings.json` file.
105
106 ```json
107 {
108         "CtrlY": "Undo",
109         "CtrlZ": "Redo"
110 }
111 ```
112
113 ### Possible commands
114
115 You can execute an editor command by pressing `Ctrl-e` followed by the command.
116 Here are the possible commands that you can use.
117
118 * `quit`: Quits micro.
119
120 * `save`: Saves the current buffer.
121
122 * `replace "search" "value" flags`: This will replace `search` with `value`. 
123    The `flags` are optional.
124    At this point, there is only one flag: `c`, which enables `check` mode 
125    which asks if you'd like to perform the replacement each time
126
127    Note that `search` must be a valid regex.  If one of the arguments
128    does not have any spaces in it, you may omit the quotes.
129
130 * `set option value`: sets the option to value. Please see the next section for
131    a list of options you can set.
132
133 * `run sh-command`: runs the given shell command in the background. The 
134    command's output will be displayed in one line when it finishes running.
135
136 * `bind key action`: creates a keybinding from key to action. See the sections on
137    keybindings above for more info about what keys and actions are available.
138
139 * `vsplit filename`: opens a vertical split with `filename`. If no filename is
140    provided, a vertical split is opened with an empty buffer
141
142 * `hsplit filename`: same as `vsplit` but opens a horizontal split instead of
143    a vertical split
144
145 * `tab filename`: opens the given file in a new tab.
146
147 ### Options
148
149 Micro stores all of the user configuration in its configuration directory.
150
151 Micro uses the `$XDG_CONFIG_HOME/micro` as the configuration directory. As per
152 the XDG spec, if `$XDG_CONFIG_HOME` is not set, `~/.config/micro` is used as 
153 the config directory.
154
155 Here are the options that you can set:
156
157 * `colorscheme`: loads the colorscheme stored in 
158    $(configDir)/colorschemes/`option`.micro
159
160         default value: `default`
161         Note that the default colorschemes (default, solarized, and solarized-tc)
162         are not located in configDir, because they are embedded in the micro binary
163
164         The colorscheme can be selected from all the files in the 
165         ~/.config/micro/colorschemes/ directory. Micro comes by default with three
166         colorschemes:
167
168         * default: this is the default colorscheme.
169
170         * solarized: this is the solarized colorscheme (used in the screenshot). 
171           You should have the solarized color palette in your terminal to use it.
172
173         * solarized-tc: this is the solarized colorscheme for true color, just 
174           make sure your terminal supports true color before using it and that the 
175           MICRO_TRUECOLOR environment variable is set to 1 before starting micro.
176
177         * monokai-tc: this is the monokai colorscheme. It requires true color to
178           look perfect, but the 256 color approximation looks good as well.
179
180         * atom-dark-tc: this colorscheme is based off of Atom's "dark" colorscheme.
181           It requires true color to look good.
182
183
184 * `tabsize`: sets the tab size to `option`
185
186         default value: `4`
187
188 * `indentchar`: sets the indentation character
189
190         default value: ` `
191
192 * `ignorecase`: perform case-insensitive searches
193
194         default value: `off`
195
196 * `syntax`: turns syntax on or off
197
198         default value: `on`
199
200 * `tabstospaces`: use spaces instead of tabs
201
202         default value: `off`
203
204 * `autoindent`: when creating a new line use the same indentation as the 
205    previous line
206
207         default value: `on`
208
209 * `cursorline`: highlight the line that the cursor is on in a different color
210    (the color is defined by the colorscheme you are using)
211
212         default value: `off`
213
214 * `ruler`: display line numbers
215
216         default value: `on`
217
218 * `statusline`: display the status line at the bottom of the screen
219
220         default value: `on`
221
222 * `savecursor`: remember where the cursor was last time the file was opened and
223    put it there when you open the file again
224
225         default value: `off`
226
227 * `saveundo`: when this option is on, undo is saved even after you close a file
228    so if you close and reopen a file, you can keep undoing
229
230         default value: `off`
231
232 * `scrollmargin`: amount of lines you would like to see above and below the cursor
233
234         default value: `3`
235
236 * `scrollspeed`: amount of lines to scroll for one scroll event
237
238         default value: `2`
239
240 ---
241
242 Default plugin options:
243
244 * `linter`: lint languages on save (supported languages are C, D, Go, Java,
245    Javascript, Lua). Provided by the `linter` plugin.
246
247         default value: `on`
248
249 * `autoclose`: Automatically close `{}` `()` `[]` `""` `''`. Provided by the autoclose plugin
250
251         default value: `on`
252
253 * `goimports`: Run goimports on save. Provided by the `go` plugin.
254
255         default value: `off`
256
257 * `gofmt`: Run gofmt on save. Provided by the `go` plugin.
258
259         default value: `on`
260
261 Any option you set in the editor will be saved to the file 
262 ~/.config/micro/settings.json so, in effect, your configuration file will be 
263 created for you. If you'd like to take your configuration with you to another
264 machine, simply copy the settings.json to the other machine.