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