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