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