]> git.lizzy.rs Git - micro.git/blob - runtime/help/options.md
Update docs
[micro.git] / runtime / help / options.md
1 # Options
2
3 Micro stores all of the user configuration in its configuration directory.
4
5 Micro uses the `$XDG_CONFIG_HOME/micro` as the configuration directory. As per
6 the XDG spec, if `$XDG_CONFIG_HOME` is not set, `~/.config/micro` is used as 
7 the config directory.
8
9 Here are the options that you can set:
10
11 * `autoindent`: when creating a new line, use the same indentation as the 
12    previous line.
13
14         default value: `true`
15
16 * `autosave`: micro will save the buffer every 8 seconds automatically. Micro
17    also will automatically save and quit when you exit without asking. Be
18    careful when using this feature, because you might accidentally save a file,
19    overwriting what was there before.
20
21         default value: `false`
22
23 * `basename`: in the infobar, show only the basename of the file being edited
24    rather than the full path.
25
26     default value: `false`
27
28 * `colorcolumn`: if this is not set to 0, it will display a column at the
29   specified column. This is useful if you want column 80 to be highlighted
30   special for example.
31
32         default value: `0`
33
34 * `colorscheme`: loads the colorscheme stored in 
35    $(configDir)/colorschemes/`option`.micro, This setting is `global only`.
36
37         default value: `default`
38
39         Note that the default colorschemes (default, solarized, and solarized-tc)
40         are not located in configDir, because they are embedded in the micro binary.
41
42         The colorscheme can be selected from all the files in the 
43         ~/.config/micro/colorschemes/ directory. Micro comes by default with three
44         colorschemes:
45
46         You can read more about micro's colorschemes in the `colors` help topic
47         (`help colors`).
48
49 * `cursorline`: highlight the line that the cursor is on in a different color
50    (the color is defined by the colorscheme you are using).
51
52         default value: `true`
53
54 * `encoding`: the encoding to open and save files with. Supported encodings
55    are listed at https://www.w3.org/TR/encoding/.
56
57     default value: `utf-8`
58
59 * `eofnewline`: micro will automatically add a newline to the file.
60
61         default value: `false`
62
63 * `fastdirty`: this determines what kind of algorithm micro uses to determine if
64    a buffer is modified or not. When `fastdirty` is on, micro just uses a
65    boolean `modified` that is set to `true` as soon as the user makes an edit.
66    This is fast, but can be inaccurate. If `fastdirty` is off, then micro will
67    hash the current buffer against a hash of the original file (created when the
68    buffer was loaded). This is more accurate but obviously more resource
69    intensive. This option is only for people who really care about having
70    accurate modified status.
71
72         default value: `true`
73
74 * `fileformat`: this determines what kind of line endings micro will use for the
75    file. UNIX line endings are just `\n` (linefeed) whereas dos line endings are
76    `\r\n` (carriage return + linefeed). The two possible values for this option
77    are `unix` and `dos`. The fileformat will be automatically detected (when you
78    open an existing file) and displayed on the statusline, but this option is
79    useful if you would like to change the line endings or if you are starting a
80    new file.
81
82         default value: `unix`
83
84 * `filetype`: sets the filetype for the current buffer. This setting is
85    `local only`.
86
87         default value: this will be automatically set depending on the file you have
88         open
89
90 * `ignorecase`: perform case-insensitive searches.
91
92         default value: `false`
93
94 * `indentchar`: sets the indentation character.
95
96         default value: ` ` (space)
97
98 * `infobar`: enables the line at the bottom of the editor where messages are
99    printed. This option is `global only`.
100
101         default value: `true`
102
103 * `keepautoindent`: when using autoindent, whitespace is added for you. This
104    option determines if when you move to the next line without any insertions
105    the whitespace that was added should be deleted to remove trailing whitespace.
106    By default, the autoindent whitespace is deleted if the line was left empty.
107
108         default value: `false`
109
110 * `keymenu`: display the nano-style key menu at the bottom of the screen. Note
111    that ToggleKeyMenu is bound to `Alt-g` by default and this is displayed in
112    the statusline. To disable this, simply by `Alt-g` to `UnbindKey`.
113
114         default value: `false`
115
116 * `matchbrace`: highlight matching braces for '()', '{}', '[]'
117
118     default value: `false`
119
120 * `matchbraceleft`: when matching a closing brace, should matching match the
121    brace directly under the cursor, or the character to the left? only matters
122    if `matchbrace` is true
123
124     default value: `false`
125
126 * `mouse`: whether to enable mouse support. When mouse support is disabled,
127    usually the terminal will be able to access mouse events which can be useful
128    if you want to copy from the terminal instead of from micro (if over ssh for
129    example, because the terminal has access to the local clipboard and micro
130    does not).
131
132         default value: `true`
133
134 * `pluginchannels`: contains all the channels micro's plugin manager will search
135    for plugins in. A channel is simply a list of 'repository' json files which
136    contain metadata about the given plugin. See the `Plugin Manager` section of
137    the `plugins` help topic for more information.
138
139         default value: `https://github.com/micro-editor/plugin-channel`
140
141 * `pluginrepos`: contains all the 'repositories' micro's plugin manager will
142    search for plugins in. A repository consists of a `repo.json` file which
143    contains metadata for a single plugin.
144
145         default value: ` `
146
147 * `rmtrailingws`: micro will automatically trim trailing whitespaces at eol.
148
149         default value: `false`
150
151 * `ruler`: display line numbers.
152
153         default value: `true`
154
155 * `savecursor`: remember where the cursor was last time the file was opened and
156    put it there when you open the file again.
157
158         default value: `false`
159
160 * `savehistory`: remember command history between closing and re-opening
161    micro.
162
163     default value: `true`
164
165 * `saveundo`: when this option is on, undo is saved even after you close a file
166    so if you close and reopen a file, you can keep undoing.
167
168         default value: `false`
169
170 * `scrollbar`: display a scroll bar
171
172     default value: `false`
173
174 * `scrollmargin`: amount of lines you would like to see above and below the
175    cursor.
176
177         default value: `3`
178
179 * `scrollspeed`: amount of lines to scroll for one scroll event.
180
181         default value: `2`
182
183 * `smartpaste`: should micro add leading whitespace when pasting multiple lines?
184    This will attempt to preserve the current indentation level when pasting an
185    unindented block.
186
187         default value: `true`
188
189 * `softwrap`: should micro wrap lines that are too long to fit on the screen.
190
191         default value: `false`
192
193 * `splitbottom`: when a horizontal split is created, should it be created below
194    the current split?
195
196         default value: `true`
197
198 * `splitright`: when a vertical split is created, should it be created to the
199    right of the current split?
200
201         default value: `true`
202
203 * `statusline`: display the status line at the bottom of the screen.
204
205         default value: `true`
206
207 * `sucmd`: specifies the super user command. On most systems this is "sudo" but
208    on BSD it can be "doas." This option can be customized and is only used when
209    saving with su.
210
211         default value: `sudo`
212
213 * `syntax`: turns syntax on or off.
214
215         default value: `true`
216
217 * `tabmovement`: navigate spaces at the beginning of lines as if they are tabs
218    (e.g. move over 4 spaces at once). This option only does anything if
219    `tabstospaces` is on.
220
221         default value: `false`
222
223 * `tabsize`: sets the tab size to `option`
224
225         default value: `4`
226
227 * `tabstospaces`: use spaces instead of tabs
228
229         default value: `false`
230
231 * `termtitle`: defines whether or not your terminal's title will be set by micro
232    when opened.
233
234         default value: `false`
235
236 * `useprimary` (only useful on *nix): defines whether or not micro will use the
237    primary clipboard to copy selections in the background. This does not affect
238    the normal clipboard using Ctrl-C and Ctrl-V.
239
240         default value: `true`
241
242 ---
243
244 Default plugin options:
245
246 * `autoclose`: automatically close `{}` `()` `[]` `""` `''`. Provided by the
247    `autoclose` plugin
248
249         default value: `true`
250
251 * `ftoptions`: by default, micro will set some options based on the filetype. At
252    the moment, micro will use tabs for makefiles and spaces for python and yaml
253    files regardless of your settings. If you would like to disable this behavior
254    turn this option off.
255
256         default value: `true`
257
258 * `linter`: Automatically lint when the file is saved. Provided by the `linter`
259    plugin.
260
261         default value: `true`
262
263 Any option you set in the editor will be saved to the file 
264 ~/.config/micro/settings.json so, in effect, your configuration file will be 
265 created for you. If you'd like to take your configuration with you to another
266 machine, simply copy the settings.json to the other machine.
267
268
269 ## Global and local settings
270
271 You can set these settings either globally or locally. Locally means that the
272 setting won't be saved to `~/.config/micro/settings.json` and that it will only
273 be set in the current buffer. Setting an option globally is the default, and
274 will set the option in all buffers.
275
276 The `colorscheme` option is global only, and the `filetype` option is local
277 only. To set an option locally, use `setlocal` instead of `set`.
278
279 In the `settings.json` file you can also put set options locally by specifying either
280 a glob or a filetype. Here is an example which has `tabstospaces` on for all files except Go
281 files, and `tabsize` 4 for all files except Ruby files:
282
283 ```json
284 {
285         "ft:go": {
286                 "tabstospaces": false
287         },
288         "ft:ruby": {
289                 "tabsize": 2
290         },
291         "tabstospaces": true,
292         "tabsize": 4
293 }
294 ```
295
296 Or similarly you can match with globs:
297
298 ```json
299 {
300         "*.go": {
301                 "tabstospaces": false
302         },
303         "*.rb": {
304                 "tabsize": 2
305         },
306         "tabstospaces": true,
307         "tabsize": 4
308 }
309 ```