]> git.lizzy.rs Git - micro.git/blob - runtime/help/help.md
Constrain help text to 80 columns
[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 #### Editor bindings
24
25 * Ctrl-q:   Quit
26 * Ctrl-e:   Execute a command
27 * Ctrl-g:   Toggle help text
28 * Ctrl-b:   Run a shell command
29
30 #### Buffer bindings
31
32 * Ctrl-s:   Save
33 * Ctrl-o:   Open file
34 * Ctrl-z:   Undo
35 * Ctrl-y:   Redo
36 * Ctrl-f:   Find
37 * Ctrl-n:   Find next
38 * Ctrl-p:   Find previous
39 * Ctrl-a:   Select all
40 * Ctrl-c:   Copy
41 * Ctrl-x:   Cut
42 * Ctrl-k:   Cut line
43 * Ctrl-v:   Paste
44 * Ctrl-u:   Half page up
45 * Ctrl-d:   Half page down
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 ### Possible commands
72
73 You can execute an editor command by pressing `Ctrl-e` followed by the command.
74 Here are the possible commands that you can use.
75
76 * `quit`: Quits micro.
77 * `save`: Saves the current buffer.
78
79 * `replace "search" "value" flags`: This will replace `search` with `value`. 
80    The `flags` are optional.
81    At this point, there is only one flag: `c`, which enables `check` mode 
82    which asks if you'd like to perform the replacement each time
83
84    Note that `search` must be a valid regex.  If one of the arguments
85    does not have any spaces in it, you may omit the quotes.
86
87 * `set option value`: sets the option to value. Please see the next section for
88    a list of options you can set.
89
90 * `run sh-command`: runs the given shell command in the background. The 
91    command's output will be displayed in one line when it finishes running.
92
93 ### Options
94
95 Micro stores all of the user configuration in its configuration directory.
96
97 Micro uses the `$XDG_CONFIG_HOME/micro` as the configuration directory. As per
98 the XDG spec, if `$XDG_CONFIG_HOME` is not set, `~/.config/micro` is used as 
99 the config directory.
100
101 Here are the options that you can set:
102
103 * `colorscheme`: loads the colorscheme stored in 
104    $(configDir)/colorschemes/`option`.micro
105
106         default value: `default`
107         Note that the default colorschemes (default, solarized, and solarized-tc)
108     are not located in configDir, because they are embedded in the micro binary
109
110     The colorscheme can be selected from all the files in the 
111     ~/.config/micro/colorschemes/ directory. Micro comes by default with three
112     colorschemes:
113
114     * default: this is the default colorscheme.
115     * solarized: this is the solarized colorscheme (used in the screenshot). 
116       You should have the solarized color palette in your terminal to use it.
117     * solarized-tc: this is the solarized colorscheme for true color, just 
118       make sure your terminal supports true color before using it and that the 
119       MICRO_TRUECOLOR environment variable is set to 1 before starting micro.
120
121
122 * `tabsize`: sets the tab size to `option`
123
124         default value: `4`
125
126 * `syntax`: turns syntax on or off
127
128         default value: `on`
129
130 * `tabsToSpaces`: use spaces instead of tabs
131
132         default value: `off`
133
134 * `autoindent`: when creating a new line use the same indentation as the 
135    previous line
136
137     default value: `on`
138
139 * `ruler`: display line numbers
140
141     default value: `on`
142
143 * `gofmt`: Run `gofmt` whenever the file is saved (this only applies to `.go` 
144    files)
145
146     default value: `off`
147
148 * `goimports`: run `goimports` whenever the file is saved (this only applies 
149    to `.go` files)
150
151     default value: `off`
152
153 Any option you set in the editor will be saved to the file 
154 ~/.config/micro/settings.json so, in effect, your configuration file will be 
155 created for you. If you'd like to take your configuration with you to another
156 machine, simply copy the settings.json to the other machine.
157
158 In the future, the `gofmt` and `goimports` will be refactored using a plugin 
159 system. However, currently they make it easier to program micro in micro.