]> git.lizzy.rs Git - micro.git/blob - runtime/help/help.md
5e60789aafa852ea0fe993cada47fd1bf8129d5c
[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 line
48 * End:      Go to end of line
49 * Ctrl-r:   Toggle line numbers
50
51 You can use the alt keys + arrows to move word by word.
52 Ctrl left and right move the cursor to the start and end of the line, and
53 ctrl up and down move the cursor the start and end of the buffer.
54
55 You can hold shift with all of these movement actions to select while moving.
56
57 The buffer bindings may be rebound using the `~/.config/micro/bindings.json` file. Each key is bound to an action.
58
59 For example, to bind `Ctrl-y` to undo and `Ctrl-z` to redo, you could put the following in the `bindings.json` file.
60
61 ```json
62 {
63     "CtrlY": "Undo",
64     "CtrlZ": "Redo"
65 }
66 ```
67
68 ### Possible commands
69
70 You can execute an editor command by pressing `Ctrl-e` followed by the command.
71 Here are the possible commands that you can use.
72
73 * `quit`: Quits micro.
74 * `save`: Saves the current buffer.
75
76 * `replace "search" "value" flags`: This will replace `search` with `value`. The `flags` are optional.
77    At this point, there is only one flag: `c`, which enables `check` mode which asks if you'd like
78    to perform the replacement each time
79
80    Note that `search` must be a valid regex.  If one of the arguments
81    does not have any spaces in it, you may omit the quotes.
82
83 * `set option value`: sets the option to value. Please see the next section for a list of options you can set.
84
85 * `run sh-command`: runs the given shell command in the background. The command's output will be displayed
86 in one line when it finishes running.
87
88 ### Options
89
90 Micro stores all of the user configuration in its configuration directory.
91
92 Micro uses the `$XDG_CONFIG_HOME/micro` as the configuration directory. As per the XDG spec,
93 if `$XDG_CONFIG_HOME` is not set, `~/.config/micro` is used as the config directory.
94
95 Here are the options that you can set:
96
97 * `colorscheme`: loads the colorscheme stored in $(configDir)/colorschemes/`option`.micro
98
99         default value: `default`
100         Note that the default colorschemes (default, solarized, and solarized-tc) are not located in configDir,
101         because they are embedded in the micro binary
102
103     The colorscheme can be selected from all the files in the ~/.config/micro/colorschemes/ directory. Micro comes by default with three colorschemes:
104
105     * default: this is the default colorscheme.
106     * solarized: this is the solarized colorscheme (used in the screenshot). You should have the 
107       solarized color palette in your terminal to use it.
108     * solarized-tc: this is the solarized colorscheme for true color, just make sure 
109       your terminal supports true color before using it and that the MICRO_TRUECOLOR environment
110       variable is set to 1 before starting micro.
111
112
113 * `tabsize`: sets the tab size to `option`
114
115         default value: `4`
116
117 * `syntax`: turns syntax on or off
118
119         default value: `on`
120
121 * `tabsToSpaces`: use spaces instead of tabs
122
123         default value: `off`
124
125 * `autoindent`: when creating a new line use the same indentation as the previous line
126
127     default value: `on`
128
129 * `ruler`: display line numbers
130
131     default value: `on`
132
133 * `gofmt`: Run `gofmt` whenever the file is saved (this only applies to `.go` files)
134
135     default value: `off`
136
137 * `goimports`: run `goimports` whenever the file is saved (this only applies to `.go` files)
138
139     default value: `off`
140
141 Any option you set in the editor will be saved to the file ~/.config/micro/settings.json so, 
142 in effect, your configuration file will be created for you. If you'd like to take your configuration
143 with you to another machine, simply copy the settings.json to the other machine.
144
145 In the future, the `gofmt` and `goimports` will be refactored using a plugin system. However,
146 currently they just make it easier to program micro in micro.