**micro** is a terminal-based text editor that aims to be easy to use and intuitive, while also taking advantage of the capabilities of modern terminals. It comes as a single, batteries-included, static binary with no dependencies; you can download and use it right now!
As its name indicates, micro aims to be somewhat of a successor to the nano editor by being easy to install and use. It strives to be enjoyable as a full-time editor for people who prefer to work in a terminal, or those who regularly edit files over [SSH](../network/SSH.md).
Micro provides the following commands that can be executed at the command-bar by pressing `Ctrl-e` and entering the command. Arguments are placed in single quotes here but these are not necessary when entering the command in micro.
-`bind 'key' 'action'`: creates a keybinding from key to action. See the `keybindings` documentation for more information about binding keys. This command will modify `bindings.json` and overwrite any bindings to `key` that already exist.
-`help 'topic'?`: opens the corresponding help topic. If no topic is provided opens the default help screen. Help topics are stored as `.md` files in the `runtime/help` directory of the source tree, which is embedded in the final binary.
-`save 'filename'?`: saves the current buffer. If the file is provided it will 'save as' the filename.
-`quit`: quits micro.
-`goto 'line'`: jumps to the given line number. A negative number can be passed to jump inward from the end of the file; for example, -5 jumps to the 5th-last line in the file.
Note that `search` must be a valid [regex](../../tools/Regex.md) (unless `-l` is passed). If one of the arguments does not have any spaces in it, you may omit the quotes.
-`replaceall 'search' 'value'`: this will replace all occurrences of `search` with `value` without user confirmation.
See `replace` command for more information.
-`set 'option' 'value'`: sets the option to value. See the `options` help topic for a list of options you can set. This will modify your `settings.json` with the new value.
-`setlocal 'option' 'value'`: sets the option to value locally (only in the current buffer). This will _not_ modify `settings.json`.
-`show 'option'`: shows the current value of the given option.
-`run 'sh-command'`: runs the given [shell](Shell.md) command in the background. The command's output will be displayed in one line when it finishes running.
-`tabmove '[-+]?n'`: Moves the active tab to another slot. `n` is an integer. If `n` is prefixed with `-` or `+`, then it represents a relative position (e.g. `tabmove +2` moves the tab to the right by `2`). If `n` has no prefix, it represents an absolute position (e.g. `tabmove 2` moves the tab to slot `2`).
-`tabswitch 'tab'`: This command will switch to the specified tab. The `tab` can either be a tab number, or a name of a tab.
-`textfilter 'sh-command'`: filters the current selection through a [shell](Shell.md) command as standard input and replaces the selection with the stdout of the [shell](Shell.md) command. For example, to sort a list of numbers, first select them, and then execute `> textfilter sort -n`.
-`raw`: micro will open a new tab and show the escape sequence for every event it receives from the terminal. This shows you what micro actually sees from the terminal and helps you see which bindings aren't possible and why. This is most useful for debugging keybindings.
-`term exec?`: Open a terminal emulator running the given executable. If no executable is given, this will open the default [shell](Shell.md) in the terminal emulator.
## Settings
Micro stores all of the user configuration in its configuration directory.
Micro uses `$MICRO_CONFIG_HOME` as the configuration directory. If this
environment variable is not set, it uses `$XDG_CONFIG_HOME/micro` instead. If
that environment variable is not set, it uses `~/.config/micro` as the
configuration directory. In the documentation, we use `~/.config/micro` to
refer to the configuration directory (even if it may in fact be somewhere else
if you have set either of the above environment variables). Settings are stored in `settings.json`
Here are the available options:
*`autoindent`: when creating a new line, use the same indentation as the
previous line.
default value: `true`
*`autosave`: automatically save the buffer every n seconds, where n is the
value of the autosave option. Also when quitting on a modified buffer, micro
will automatically save and quit. Be warned, this option saves the buffer
without prompting the user, so data may be overwritten. If this option is
set to `0`, no autosaving is performed.
default value: `0`
*`autosu`: When a file is saved that the user doesn't have permission to
modify, micro will ask if the user would like to use super user
privileges to save the file. If this option is enabled, micro will
automatically attempt to use super user privileges to save without
asking the user.
default value: `false`
*`backup`: micro will automatically keep backups of all open buffers. Backups
are stored in `~/.config/micro/backups` and are removed when the buffer is
closed cleanly. In the case of a system crash or a micro crash, the contents
of the buffer can be recovered automatically by opening the file that was
being edited before the crash, or manually by searching for the backup in
the backup directory. Backups are made in the background for newly modified
buffers every 8 seconds, or when micro detects a crash.
default value: `true`
*`backupdir`: the directory micro should place backups in. For the default
value of `""` (empty string), the backup directory will be
`ConfigDir/backups`, which is `~/.config/micro/backups` by default. The
directory specified for backups will be created if it does not exist.
default value: `""` (empty string)
*`basename`: in the infobar and tabbar, show only the basename of the file
being edited rather than the full path.
default value: `false`
*`clipboard`: specifies how micro should access the system clipboard.
Possible values are:
*`external`: accesses clipboard via an external tool, such as xclip/xsel
or wl-clipboard on [Linux](../../linux/Linux.md), pbcopy/pbpaste on [MacOS](../../macos/macOS.md), and system calls on
[Windows](../../windows/Windows.md). On Linux, if you do not have one of the tools installed, or if
they are not working, micro will throw an error and use an internal
clipboard.
*`terminal`: accesses the clipboard via your terminal emulator. Note that
there is limited support among terminal emulators for this feature
(called OSC 52). Terminals that are known to work are Kitty (enable
reading with `clipboard_control` setting), iTerm2 (only copying),
st, rxvt-unicode and xterm if enabled (see `> help copypaste` for
details). Note that Gnome-terminal does not support this feature. With