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