]> git.lizzy.rs Git - micro.git/blob - runtime/help/help.md
Forgot a comma there
[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 * `syntax`: turns syntax on or off
186
187         default value: `on`
188
189 * `tabsToSpaces`: use spaces instead of tabs
190
191         default value: `off`
192
193 * `autoindent`: when creating a new line use the same indentation as the 
194    previous line
195
196     default value: `on`
197
198 * `ruler`: display line numbers
199
200     default value: `on`
201
202 * `statusline`: display the status line at the bottom of the screen
203
204     default value: `on`
205
206 * `scrollSpeed`: amount of lines to scroll
207
208         default value: `2`
209
210 ---
211
212 Default plugin options:
213
214 * `linter`: lint languages on save (supported languages are C, D, Go, Java,
215    Javascript, Lua). Provided by the `linter` plugin.
216
217     default value: `on`
218
219 * `goimports`: Run goimports on save. Provided by the `go` plugin.
220
221     default value: `off`
222
223 * `gofmt`: Run gofmt on save. Provided by the `go` 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.