]> git.lizzy.rs Git - micro.git/blob - runtime/help/help.md
Add check flag for search and replace
[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 `micro path/to/file.txt` or simply `micro` to open an empty buffer.
9
10 Micro also supports creating buffers from stdin:
11
12 ```
13 $ ifconfig | micro
14 ```
15
16 You can move the cursor around with the arrow keys and mouse.
17
18 ### Keybindings
19
20 These are the default keybindings, along with their actions.
21
22 #### Editor bindings
23
24 * Ctrl-q:   Quit
25 * Ctrl-e:   Execute a command
26 * Ctrl-g:   Toggle help text
27 * Ctrl-b:   Run a shell command
28
29 #### Buffer bindings
30
31 * Ctrl-s:   Save
32 * Ctrl-o:   Open file
33 * Ctrl-z:   Undo
34 * Ctrl-y:   Redo
35 * Ctrl-f:   Find
36 * Ctrl-n:   Find next
37 * Ctrl-p:   Find previous
38 * Ctrl-a:   Select all
39 * Ctrl-c:   Copy
40 * Ctrl-x:   Cut
41 * Ctrl-k:   Cut line
42 * Ctrl-v:   Paste
43 * Ctrl-u:   Half page up
44 * Ctrl-d:   Half page down
45 * PageUp:   Page up
46 * PageDown: Page down
47 * Home:     Go to beginning of file
48 * End:      Go to end of file
49 * Ctrl-r:   Toggle line numbers
50
51 The buffer bindings may be rebound using the `~/.config/micro/bindings.json` file. Each key is bound to an action.
52
53 For example, to bind `Ctrl-y` to undo and `Ctrl-z` to redo, you could put the following in the `bindings.json` file.
54
55 ```json
56 {
57     "CtrlY": "Undo",
58     "CtrlZ": "Redo"
59 }
60 ```
61
62 ### Possible commands
63
64 You can execute an editor command by pressing `Ctrl-e` followed by the command.
65 Here are the possible commands that you can use.
66
67 * `quit`: Quits micro.
68 * `save`: Saves the current buffer.
69
70 * `replace "search" "value" flags`: This will replace `search` with `value`. The `flags` are optional.
71    At this point, there is only one flag: `c`, which enables `check` mode which asks if you'd like
72    to perform the replacement each time
73
74    Note that `search` must be a valid regex.  If one of the arguments
75    does not have any spaces in it, you may omit the quotes.
76
77 * `set option value`: sets the option to value. Please see the next section for a list of options you can set.
78
79 * `run sh-command`: runs the given shell command in the background. The command's output will be displayed
80 in one line when it finishes running.
81
82 ### Options
83
84 Micro stores all of the user configuration in its configuration directory.
85
86 Micro uses the `$XDG_CONFIG_HOME/micro` as the configuration directory. As per the XDG spec,
87 if `$XDG_CONFIG_HOME` is not set, `~/.config/micro` is used as the config directory.
88
89 Here are the options that you can set:
90
91 * `colorscheme`: loads the colorscheme stored in $(configDir)/colorschemes/`option`.micro
92
93         default value: `default`
94         Note that the default colorschemes (default, solarized, and solarized-tc) are not located in configDir,
95         because they are embedded in the micro binary
96
97     The colorscheme can be selected from all the files in the ~/.config/micro/colorschemes/ directory. Micro comes by default with three colorschemes:
98
99     * default: this is the default colorscheme.
100     * solarized: this is the solarized colorscheme (used in the screenshot). You should have the 
101       solarized color palette in your terminal to use it.
102     * solarized-tc: this is the solarized colorscheme for true color, just make sure 
103       your terminal supports true color before using it and that the MICRO_TRUECOLOR environment
104       variable is set to 1 before starting micro.
105
106
107 * `tabsize`: sets the tab size to `option`
108
109         default value: `4`
110
111 * `syntax`: turns syntax on or off
112
113         default value: `on`
114
115 * `tabsToSpaces`: use spaces instead of tabs
116
117         default value: `off`
118
119 * `autoindent`: when creating a new line use the same indentation as the previous line
120
121     default value: `on`
122
123 * `ruler`: display line numbers
124
125     default value: `on`
126
127 * `gofmt`: Run `gofmt` whenever the file is saved (this only applies to `.go` files)
128
129     default value: `off`
130
131 * `goimports`: run `goimports` whenever the file is saved (this only applies to `.go` files)
132
133     default value: `off`
134
135 Any option you set in the editor will be saved to the file ~/.config/micro/settings.json so, 
136 in effect, your configuration file will be created for you. If you'd like to take your configuration
137 with you to another machine, simply copy the settings.json to the other machine.
138
139 In the future, the `gofmt` and `goimports` will be refactored using a plugin system. However,
140 currently they just make it easier to program micro in micro.