Debian Codegraph @

README.md

raw
1 <img alt="micro logo" src="./assets/micro-logo-drop.svg" width="500px"/>
2
3 ![Test Workflow](https://github.com/zyedidia/micro/actions/workflows/test.yaml/badge.svg)
4 [![Go Report Card](https://goreportcard.com/badge/github.com/zyedidia/micro/v2)](https://goreportcard.com/report/github.com/zyedidia/micro/v2)
5 [![Release](https://img.shields.io/github/release/zyedidia/micro.svg?label=Release)](https://github.com/zyedidia/micro/releases)
6 [![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/zyedidia/micro/blob/master/LICENSE)
7 [![Join the chat at https://gitter.im/zyedidia/micro](https://badges.gitter.im/zyedidia/micro.svg)](https://gitter.im/zyedidia/micro?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
8 [![Snap Status](https://snapcraft.io/micro/badge.svg)](https://snapcraft.io/micro)
9
10 **micro** is a terminal-based text editor that aims to be easy to use and intuitive, while also taking advantage of the capabilities
11 of modern terminals. It comes as a single, batteries-included, static binary with no dependencies; you can download and use it right now!
12
13 As its name indicates, micro aims to be somewhat of a successor to the nano editor by being easy to install and use.
14 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.
15
16 Here is a picture of micro editing its source code.
17
18 ![Screenshot](./assets/micro-solarized.png)
19
20 To see more screenshots of micro, showcasing some of the default color schemes, see [here](https://micro-editor.github.io).
21
22 You can also check out the website for Micro at https://micro-editor.github.io.
23
24 - - -
25
26 ## Features
27
28 - Easy to use and install.
29 - No dependencies or external files are needed — just the binary you can download further down the page.
30 - Multiple cursors.
31 - Common keybindings (<kbd>Ctrl-s</kbd>, <kbd>Ctrl-c</kbd>, <kbd>Ctrl-v</kbd>, <kbd>Ctrl-z</kbd>, …).
32 - Keybindings can be rebound to your liking.
33 - Sane defaults.
34 - You shouldn't have to configure much out of the box (and it is extremely easy to configure).
35 - Splits and tabs.
36 - nano-like menu to help you remember the keybindings.
37 - Extremely good mouse support.
38 - This means mouse dragging to create a selection, double click to select by word, and triple click to select by line.
39 - Cross-platform (it should work on all the platforms Go runs on).
40 - Note that while Windows is supported, Mingw/Cygwin is not (see below).
41 - Plugin system (plugins are written in Lua).
42 - micro has a built-in plugin manager to automatically install, remove, and update plugins.
43 - Built-in diff gutter.
44 - Simple autocompletion.
45 - Persistent undo.
46 - Automatic linting and error notifications.
47 - Syntax highlighting for over [130 languages](runtime/syntax).
48 - Color scheme support.
49 - By default, micro comes with 16, 256, and true color themes.
50 - True color support.
51 - Copy and paste with the system clipboard.
52 - Small and simple.
53 - Easily configurable.
54 - Macros.
55 - Smart highlighting of trailing whitespace and tab vs space errors.
56 - Common editor features such as undo/redo, line numbers, Unicode support, soft wrapping, …
57
58 ## Installation
59
60 To install micro, you can download a [prebuilt binary](https://github.com/zyedidia/micro/releases), or you can build it from source.
61
62 If you want more information about ways to install micro, see this [wiki page](https://github.com/zyedidia/micro/wiki/Installing-Micro).
63
64 Use `micro -version` to get the version information after installing. It is only guaranteed that you are installing the most recent
65 stable version if you install from the prebuilt binaries, Homebrew, or Snap.
66
67 A desktop entry file and man page can be found in the [assets/packaging](https://github.com/zyedidia/micro/tree/master/assets/packaging) directory.
68
69 ### Pre-built binaries
70
71 Pre-built binaries are distributed in [releases](https://github.com/zyedidia/micro/releases).
72
73 To uninstall micro, simply remove the binary, and the configuration directory at `~/.config/micro`.
74
75 #### Third-party quick-install script
76
77 ```bash
78 curl https://getmic.ro | bash
79 ```
80
81 The script will place the micro binary in the current directory. From there, you can move it to a directory on your path of your choosing (e.g. `sudo mv micro /usr/bin`). See its [GitHub repository](https://github.com/benweissmann/getmic.ro) for more information.
82
83 #### Eget
84
85 With [Eget](https://github.com/zyedidia/eget) installed, you can easily get a pre-built binary:
86
87 ```
88 eget zyedidia/micro
89 ```
90
91 Use `--tag VERSION` to download a specific tagged version.
92
93 ```
94 eget --tag nightly zyedidia/micro # download the nightly version (compiled every day at midnight UTC)
95 eget --tag v2.0.8 zyedidia/micro # download version 2.0.8 rather than the latest release
96 ```
97
98 You can install `micro` by adding `--to /usr/local/bin` to the `eget` command, or move the binary manually to a directory on your `$PATH` after the download completes.
99
100 See [Eget](https://github.com/zyedidia/eget) for more information.
101
102 ### Package managers
103
104 You can install micro using Homebrew on Mac:
105
106 ```
107 brew install micro
108 ```
109
110 **Note for Mac:** All micro keybindings use the control or alt (option) key, not the command
111 key. By default, macOS terminals do not forward alt key events. To fix this, please see
112 the section on [macOS terminals](https://github.com/zyedidia/micro#macos-terminal) further below.
113
114 On Linux, you can install micro through [snap](https://snapcraft.io/docs/core/install)
115
116 ```
117 snap install micro --classic
118 ```
119
120 Micro is also available through other package managers on Linux such as dnf, AUR, Nix, and package managers
121 for other operating systems. These packages are not guaranteed to be up-to-date.
122
123 <!-- * `apt install micro` (Ubuntu 20.04 `focal`, and Debian `unstable | testing | buster-backports`). At the moment, this package (2.0.1-1) is outdated and has a known bug where debug mode is enabled. -->
124
125 * Linux:
126 * distro-specific package managers:
127 * `dnf install micro` (Fedora).
128 * `apt install micro` (Ubuntu and Debian).
129 * `pacman -S micro` (Arch Linux).
130 * `emerge app-editors/micro` (Gentoo).
131 * `zypper install micro-editor` (SUSE)
132 * `eopkg install micro` (Solus).
133 * `pacstall -I micro` (Pacstall).
134 * `apt-get install micro` (ALT Linux)
135 * See [wiki](https://github.com/zyedidia/micro/wiki/Installing-Micro) for details about CRUX, Termux.
136 * distro-agnostic package managers:
137 * `nix profile install nixpkgs#micro` (with [Nix](https://nixos.org/) and flakes enabled)
138 * `flox install micro` (with [Flox](https://flox.dev))
139 * Windows: [Chocolatey](https://chocolatey.org), [Scoop](https://scoop.sh/) and [WinGet](https://learn.microsoft.com/en-us/windows/package-manager/winget/).
140 * `choco install micro`.
141 * `scoop install micro`.
142 * `winget install zyedidia.micro`
143 * OpenBSD: Available in the ports tree and also available as a binary package.
144 * `pkg_add -v micro`.
145 * NetBSD, macOS, Linux, Illumos, etc. with [pkgsrc](https://www.pkgsrc.org/)-current:
146 * `pkg_add micro`
147 * macOS: Available in package managers.
148 * `sudo port install micro` (with [MacPorts](https://www.macports.org))
149 * `brew install micro` (with [Homebrew](https://brew.sh/))
150 * `nix profile install nixpkgs#micro` (with [Nix](https://nixos.org/) and flakes enabled)
151 * `flox install micro` (with [Flox](https://flox.dev))
152
153 **Note for Linux desktop environments:**
154
155 For interfacing with the local system clipboard, the following tools need to be installed:
156 * For X11, `xclip` or `xsel`
157 * For [Wayland](https://wayland.freedesktop.org/), `wl-clipboard`
158
159 Without these tools installed, micro will use an internal clipboard for copy and paste, but it won't be accessible to external applications.
160
161 ### Building from source
162
163 If your operating system does not have a binary release, but does run Go, you can build from source.
164
165 Make sure that you have Go version 1.19 or greater and Go modules are enabled.
166
167 ```
168 git clone https://github.com/zyedidia/micro
169 cd micro
170 make build
171 sudo mv micro /usr/local/bin # optional
172 ```
173
174 The binary will be placed in the current directory and can be moved to
175 anywhere you like (for example `/usr/local/bin`).
176
177 The command `make install` will install the binary to `$GOPATH/bin` or `$GOBIN`.
178
179 You can install directly with `go get` (`go get github.com/zyedidia/micro/cmd/micro`) but this isn't
180 recommended because it doesn't build micro with version information (necessary for the plugin manager),
181 and doesn't disable debug mode.
182
183 ### Fully static or dynamically linked binary
184
185 By default, the micro binary is linked statically to increase the portability of the prebuilt binaries.
186 This behavior can simply be overriden by providing `CGO_ENABLED=1` to the build target.
187
188 ```
189 CGO_ENABLED=1 make build
190 ```
191
192 Afterwards the micro binary will dynamically link with the present core system libraries.
193
194 **Note for Mac:**
195 Native macOS builds are done with `CGO_ENABLED=1` forced set to support adding the "Information Property List" in the linker step.
196
197 ### macOS terminal
198
199 If you are using macOS, you should consider using [iTerm2](https://iterm2.com/) instead of the default terminal (Terminal.app). The iTerm2 terminal has much better mouse support as well as better handling of key events. For best keybinding behavior, choose `xterm defaults` under `Preferences->Profiles->Keys->Presets...`, and select `Esc+` for `Left Option Key` in the same menu. The newest versions also support true color.
200
201 If you still insist on using the default Mac terminal, be sure to set `Use Option key as Meta key` under
202 `Preferences->Profiles->Keyboard` to use <kbd>option</kbd> as <kbd>alt</kbd>.
203
204 ### WSL and Windows Console
205
206 If you use micro within WSL, it is highly recommended that you use the [Windows
207 Terminal](https://apps.microsoft.com/store/detail/windows-terminal/9N0DX20HK701?hl=en-us&gl=us)
208 instead of the default Windows Console.
209
210 If you must use Windows Console for some reason, note that there is a bug in
211 Windows Console WSL that causes a font change whenever micro tries to access
212 the external clipboard via powershell. To fix this, use an internal clipboard
213 with `set clipboard internal` (though your system clipboard will no longer be
214 available in micro).
215
216 ### Colors and syntax highlighting
217
218 If you open micro and it doesn't seem like syntax highlighting is working, this is probably because
219 you are using a terminal which does not support 256 color mode. Try changing the color scheme to `simple`
220 by pressing <kbd>Ctrl-e</kbd> in micro and typing `set colorscheme simple`.
221
222 If you are using the default Ubuntu terminal, to enable 256 color mode make sure your `TERM` variable is set
223 to `xterm-256color`.
224
225 Many of the Windows terminals don't support more than 16 colors, which means
226 that micro's default color scheme won't look very good. You can either set
227 the color scheme to `simple`, or download and configure a better terminal emulator
228 than the Windows default.
229
230 ### Cygwin, Mingw, Plan9
231
232 Cygwin, Mingw, and Plan9 are unfortunately not officially supported. In Cygwin and Mingw, micro will often work when run using
233 the `winpty` utility:
234
235 ```
236 winpty micro.exe ...
237 ```
238
239 Micro uses the amazing [tcell library](https://github.com/gdamore/tcell), but this
240 means that micro is restricted to the platforms tcell supports. As a result, micro does not support
241 Plan9 or Cygwin (although this may change in the future). Micro also doesn't support NaCl (which is deprecated anyway).
242
243 ## Usage
244
245 Once you have built the editor, start it by running `micro path/to/file.txt` or `micro` to open an empty buffer.
246
247 micro also supports creating buffers from `stdin`:
248
249 ```sh
250 ip a | micro
251 ```
252
253 You can move the cursor around with the arrow keys and mouse.
254
255 You can also use the mouse to manipulate the text. Simply clicking and dragging
256 will select text. You can also double click to enable word selection, and triple
257 click to enable line selection.
258
259 ## Documentation and Help
260
261 micro has a built-in help system which you can access by pressing <kbd>Ctrl-e</kbd> and typing `help`. Additionally, you can
262 view the help files here:
263
264 - [main help](https://github.com/zyedidia/micro/tree/master/runtime/help/help.md)
265 - [keybindings](https://github.com/zyedidia/micro/tree/master/runtime/help/keybindings.md)
266 - [commands](https://github.com/zyedidia/micro/tree/master/runtime/help/commands.md)
267 - [colors](https://github.com/zyedidia/micro/tree/master/runtime/help/colors.md)
268 - [options](https://github.com/zyedidia/micro/tree/master/runtime/help/options.md)
269 - [plugins](https://github.com/zyedidia/micro/tree/master/runtime/help/plugins.md)
270
271 I also recommend reading the [tutorial](https://github.com/zyedidia/micro/tree/master/runtime/help/tutorial.md) for
272 a brief introduction to the more powerful configuration features micro offers.
273
274 There is also an unofficial Discord, which you can join at https://discord.gg/nhWR6armnR.
275
276 ## Contributing
277
278 If you find any bugs, please report them! I am also happy to accept pull requests from anyone.
279
280 You can use the [GitHub issue tracker](https://github.com/zyedidia/micro/issues)
281 to report bugs, ask questions, or suggest new features.
282
283 For a more informal setting to discuss the editor, you can join the [Gitter chat](https://gitter.im/zyedidia/micro) or the [Discord](https://discord.gg/nhWR6armnR). You can also use the [Discussions](https://github.com/zyedidia/micro/discussions) section on Github for a forum-like setting or for Q&A.
284
285 Sometimes I am unresponsive, and I apologize! If that happens, please ping me.