]> git.lizzy.rs Git - micro.git/blob - runtime/help/help.md
Merge
[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 These are the default keybindings, along with their actions.
22
23
24 * Ctrl-q:   Quit
25 * Ctrl-e:   Execute a command
26 * Ctrl-g:   Toggle help text
27 * Ctrl-b:   Run a shell command
28 * Ctrl-s:   Save
29 * Ctrl-o:   Open file
30 * Ctrl-z:   Undo
31 * Ctrl-y:   Redo
32 * Ctrl-f:   Find
33 * Ctrl-n:   Find next
34 * Ctrl-p:   Find previous
35 * Ctrl-a:   Select all
36 * Ctrl-c:   Copy
37 * Ctrl-x:   Cut
38 * Ctrl-k:   Cut line
39 * Ctrl-d:   Duplicate line
40 * Ctrl-v:   Paste
41 * PageUp:   Page up
42 * PageDown: Page down
43 * Home:     Go to beginning of line
44 * End:      Go to end of line
45 * Ctrl-r:   Toggle line numbers
46
47 You can use the alt keys + arrows to move word by word.
48 Ctrl left and right move the cursor to the start and end of the line, and
49 ctrl up and down move the cursor the start and end of the buffer.
50
51 You can hold shift with all of these movement actions to select while moving.
52
53 The bindings may be rebound using the `~/.config/micro/bindings.json` 
54 file. Each key is bound to an action.
55
56 For example, to bind `Ctrl-y` to undo and `Ctrl-z` to redo, you could put the 
57 following in the `bindings.json` file.
58
59 ```json
60 {
61         "CtrlY": "Undo",
62         "CtrlZ": "Redo"
63 }
64 ```
65
66 Here are the defaults:
67
68 ```json
69 {
70     "Up":             "CursorUp",
71     "Down":           "CursorDown",
72     "Right":          "CursorRight",
73     "Left":           "CursorLeft",
74     "ShiftUp":        "SelectUp",
75     "ShiftDown":      "SelectDown",
76     "ShiftLeft":      "SelectLeft",
77     "ShiftRight":     "SelectRight",
78     "AltLeft":        "WordLeft",
79     "AltRight":       "WordRight",
80     "AltShiftRight":  "SelectWordRight",
81     "AltShiftLeft":   "SelectWordLeft",
82     "CtrlLeft":       "StartOfLine",
83     "CtrlRight":      "EndOfLine",
84     "CtrlShiftLeft":  "SelectToStartOfLine",
85     "CtrlShiftRight": "SelectToEndOfLine",
86     "CtrlUp":         "CursorStart",
87     "CtrlDown":       "CursorEnd",
88     "CtrlShiftUp":    "SelectToStart",
89     "CtrlShiftDown":  "SelectToEnd",
90     "Enter":          "InsertEnter",
91     "Space":          "InsertSpace",
92     "Backspace":      "Backspace",
93     "Backspace2":     "Backspace",
94     "Tab":            "InsertTab",
95     "CtrlO":          "OpenFile",
96     "CtrlS":          "Save",
97     "CtrlF":          "Find",
98     "CtrlN":          "FindNext",
99     "CtrlP":          "FindPrevious",
100     "CtrlZ":          "Undo",
101     "CtrlY":          "Redo",
102     "CtrlC":          "Copy",
103     "CtrlX":          "Cut",
104     "CtrlK":          "CutLine",
105     "CtrlD":          "DuplicateLine",
106     "CtrlV":          "Paste",
107     "CtrlA":          "SelectAll",
108     "Home":           "Start",
109     "End":            "End",
110     "PgUp":           "PageUp",
111     "PgDn":           "PageDown",
112     "CtrlG":          "ToggleHelp",
113     "CtrlR":          "ToggleRuler",
114     "CtrlL":          "JumpLine",
115     "Delete":         "Delete",
116     "Esc":            "ClearStatus",
117     "CtrlB":          "ShellMode",
118     "CtrlQ":          "Quit",
119     "CtrlE":          "CommandMode",
120
121     // Emacs-style keybindings
122     "Alt-f": "WordRight",
123     "Alt-b": "WordLeft",
124     "Alt-a": "StartOfLine",
125     "Alt-e": "EndOfLine",
126     "Alt-p": "CursorUp",
127     "Alt-n": "CursorDown",
128 }
129
130 ```
131
132
133 ### Possible commands
134
135 You can execute an editor command by pressing `Ctrl-e` followed by the command.
136 Here are the possible commands that you can use.
137
138 * `quit`: Quits micro.
139 * `save`: Saves the current buffer.
140
141 * `replace "search" "value" flags`: This will replace `search` with `value`. 
142    The `flags` are optional.
143    At this point, there is only one flag: `c`, which enables `check` mode 
144    which asks if you'd like to perform the replacement each time
145
146    Note that `search` must be a valid regex.  If one of the arguments
147    does not have any spaces in it, you may omit the quotes.
148
149 * `set option value`: sets the option to value. Please see the next section for
150    a list of options you can set.
151
152 * `run sh-command`: runs the given shell command in the background. The 
153    command's output will be displayed in one line when it finishes running.
154
155 ### Options
156
157 Micro stores all of the user configuration in its configuration directory.
158
159 Micro uses the `$XDG_CONFIG_HOME/micro` as the configuration directory. As per
160 the XDG spec, if `$XDG_CONFIG_HOME` is not set, `~/.config/micro` is used as 
161 the config directory.
162
163 Here are the options that you can set:
164
165 * `colorscheme`: loads the colorscheme stored in 
166    $(configDir)/colorschemes/`option`.micro
167
168         default value: `default`
169         Note that the default colorschemes (default, solarized, and solarized-tc)
170         are not located in configDir, because they are embedded in the micro binary
171
172         The colorscheme can be selected from all the files in the 
173         ~/.config/micro/colorschemes/ directory. Micro comes by default with three
174         colorschemes:
175
176         * default: this is the default colorscheme.
177         * solarized: this is the solarized colorscheme (used in the screenshot). 
178           You should have the solarized color palette in your terminal to use it.
179         * solarized-tc: this is the solarized colorscheme for true color, just 
180           make sure your terminal supports true color before using it and that the 
181           MICRO_TRUECOLOR environment variable is set to 1 before starting micro.
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 * `ruler`: display line numbers
210
211         default value: `on`
212
213 * `statusline`: display the status line at the bottom of the screen
214
215         default value: `on`
216
217 * `savecursor`: remember where the cursor was last time the file was opened and
218    put it there when you open the file again
219
220     default value: `off`
221
222 * `scrollmargin`: amount of lines you would like to see above and below the cursor
223
224         default value: `3`
225
226 * `scrollspeed`: amount of lines to scroll for one scroll event
227
228         default value: `2`
229
230 ---
231
232 Default plugin options:
233
234 * `linter`: lint languages on save (supported languages are C, D, Go, Java,
235    Javascript, Lua). Provided by the `linter` plugin.
236
237         default value: `on`
238
239 * `goimports`: Run goimports on save. Provided by the `go` plugin.
240
241         default value: `off`
242
243 * `gofmt`: Run gofmt on save. Provided by the `go` plugin.
244
245         default value: `on`
246
247 Any option you set in the editor will be saved to the file 
248 ~/.config/micro/settings.json so, in effect, your configuration file will be 
249 created for you. If you'd like to take your configuration with you to another
250 machine, simply copy the settings.json to the other machine.