]> git.lizzy.rs Git - micro.git/blob - runtime/help/commands.md
Merge pull request #1406 from LeapofAzzam/LeapofAzzam-patch-1
[micro.git] / runtime / help / commands.md
1 # Possible commands
2
3 You can execute an editor command by pressing `Ctrl-e` followed by the command.
4 Here are the possible commands that you can use.
5
6 * `quit`: Quits micro.
7
8 * `save filename?`: Saves the current buffer. If the filename is provided it
9   will 'save as' the filename.
10
11 * `replace "search" "value" flags`: This will replace `search` with `value`. 
12    The `flags` are optional. Possible flags are:
13    * `-a`: Replace all occurrences at once
14    * `-l`: Do a literal search instead of a regex search
15
16    Note that `search` must be a valid regex (unless `-l` is passed). If one 
17    of the arguments does not have any spaces in it, you may omit the quotes.
18
19 * `replaceall "search" "value"`: This will replace `search` with `value` without
20    user confirmation.
21
22         See `replace` command for more information.
23
24 * `set option value`: sets the option to value. See the `options` help topic for
25    a list of options you can set.
26
27 * `setlocal option value`: sets the option to value locally (only in the current
28    buffer).
29
30 * `show option`: shows the current value of the given option.
31
32 * `run sh-command`: runs the given shell command in the background. The 
33    command's output will be displayed in one line when it finishes running.
34
35 * `bind key action`: creates a keybinding from key to action. See the sections
36    on keybindings above for more info about what keys and actions are available.
37
38 * `vsplit filename`: opens a vertical split with `filename`. If no filename is
39    provided, a vertical split is opened with an empty buffer.
40
41 * `hsplit filename`: same as `vsplit` but opens a horizontal split instead of a
42    vertical split.
43
44 * `tab filename`: opens the given file in a new tab.
45
46 * `tabswitch tab`: This command will switch to the specified tab. The `tab` can
47    either be a tab number, or a name of a tab.
48
49 * `textfilter sh-command`: filters the current selection through a shell command
50    as standard input and replaces the selection with the stdout of the shell command.
51    For example, to sort a list of numbers, first select them, and then execute
52    `> textfilter sort -n`.
53                                          
54 * `log`: opens a log of all messages and debug statements.
55
56 * `plugin list`: lists all installed plugins.
57
58 * `plugin version pl`: shows version for specified plugin.
59
60 * `plugin info pl`: shows additional info for specified plugin.
61
62 * `reload`: reloads all runtime files.
63
64 * `cd path`: Change the working directory to the given `path`.
65
66 * `pwd`: Print the current working directory.
67
68 * `open filename`: Open a file in the current buffer.
69
70 * `reset option`: resets the given option to its default value
71
72 * `retab`: Replaces all leading tabs with spaces or leading spaces with tabs
73    depending on the value of `tabstospaces`.
74
75 * `raw`: Micro will open a new tab and show the escape sequence for every event
76    it receives from the terminal. This shows you what micro actually sees from
77    the terminal and helps you see which bindings aren't possible and why. This
78    is most useful for debugging keybindings.
79
80 * `showkey`: Show the action(s) bound to a given key. For example
81    running `> showkey CtrlC` will display `main.(*View).Copy`. Unfortuately
82    showkey does not work well for keys bound to plugin actions. For those
83    it just shows "LuaFunctionBinding."
84
85 ---
86
87 The following commands are provided by the default plugins:
88
89 * `lint`: Lint the current file for errors.
90
91 * `comment`: automatically comment or uncomment current selection or line.
92
93 # Command Parsing
94
95 When running a command, you can use extra syntax that micro will expand before
96 running the command. To use an argument with a space in it, simply put it in
97 quotes. You can also use environment variables in the command bar and they
98 will be expanded to their value. Finally, you can put an expression in backticks
99 and it will be evaluated by the shell beforehand.