Editor Series: micro A terminal-based text editor

Editor Series: micro A terminal-based text editor

2022-11-10 0 851
Resource Number 47843 Last Updated 2025-02-21
¥ 0HKD Upgrade VIP
Download Now Matters needing attention
Can't download? Please contact customer service to submit a link error!
Value-added Service: Installation Guide Environment Configuration Secondary Development Template Modification Source Code Installation

The micro recommended in this issue is a terminal-based text editor designed to be easy to use and intuitive, while also taking advantage of the capabilities of modern terminals. It is a single, battery-containing, static binary file with no dependencies; You can download and use it now!

Editor Series: micro A terminal-based text editor插图

As the name suggests, micro is intended to be the successor to the nano editor by being easy to install and use. It strives to be a full-time editor for people who like to work in a terminal or who often edit files over SSH.

This is a picture of microediting its source code.

Editor Series: micro A terminal-based text editor插图1

micro feature

  • Easy to use and install.
  • No dependencies or external files are required – just binaries that you can download at the bottom of the page.
  • Multiple cursors.
  • Common key binding (Ctrl-s, Ctrl-c, Ctrl-v, Ctrl-z,…) . Key bindings can be reconfigured to suit your preferences.
  • Sensible default. You don’t have to do much configuration out of the box (and it’s pretty easy to do).
  • Split and TAB.
  • Nanoma-like menus help you remember key bindings.
  • Very good mouse support. This means mouse dragging to create a selection, double clicking to select by word, and three clicks to select by line.
  • Cross-platform (it should work on all platforms on which Go runs). Please note that while Windows is supported, Mingw/Cygwin is not supported (see below).
  • Plug-in system (plug-ins are written in Lua). micro has a built-in plugin manager to automatically install, remove, and update plugins.
  • Built-in differential binding line.
  • Simple automatic completion.
  • Persistent undo.
  • Automatic linting and error notification.
  • Syntax highlights for more than 130 languages.
  • Color scheme support. By default, micro comes with 16, 256, and true color themes.
  • True color support (set the MICRO_TRUECOLOR environment variable to 1 to enable it).
  • Copy and paste using the system Clipboard.
  • Small and simple.
  • Easy to configure.
  • macro.
  • Common editor features such as undo/redo, line numbers, Unicode support, flexible wrapping…

micro installation

To install micro, you can either download the pre-built binary or build it from source code.

If you want to learn more about how to install micro, see this wiki page.

Used to obtain the version information after installation. If you are installing from a pre-built binary, Homebrew, or Snap, you can only guarantee that you are installing the latest stable version.

Desktop entry files and man pages can be found in the assets/packaging directory.

Prebuilt binary

Prebuilt binaries are distributed with release.

To uninstall micro, just delete the binary file and ~/.config/micro.
Quick installation script

curl https://getmic.ro |  bash

The script places the microbinaries in the current directory. From there, you can move it to a directory on the path of your choice (such as sudo mv micro /usr/bin).

Package manager

You can install micro on your Mac using Homebrew:

brew install micro

Mac note: All micro-key bindings use the control or alt (option) keys instead of the command key. By default, macOS terminals do not forward alt key events. To resolve this issue, see the section on macOS terminals below.

On Linux, you can install micro via snap

snap install micro --classic

Linux precautions: Used to interface with the local system clipboard, xclip or xsel must be installed.

Micro is also available through other package managers on Linux, such as dnf, AUR, Nix, and other operating systems. These packages are not guaranteed to be up to date.

Linux: available in a distribution-specific package manager.

  • dnf install micro (Fedora).
  • pacman -S micro (arch Linux).
  • eopkg install micro (solution).
  • For more information about CRUX, Termux, see wiki.

Window: Chocolate and Scoop.

  • choco install micro.scoop install micro.

OpenBSD: available in the port tree or as a binary package.

  • pkd_add -v micro.

NetBSD, macOS, Linux, Illumos, etc. Use pkgsrc-current:

  • pkg_add micro

macOS with MacPorts:

  • sudo port install micro

Build from the source

If your operating system doesn’t have a binary version but runs Go, you can build from source code.

Ensure that you have Go version 1.16 or later and that the Go module is enabled.

git clone  https://github.com/zyedidia/micro
cd micro
make build
sudo mv micro /usr/local/bin #  optional

The binary will be placed in the current directory and can be moved to any location you like (for example, /usr/local/bin).

The command make install will install the binary to $GOPATH/bin or $GOBIN.

You can use go get(go get
Github.com/zyedidia/micro/cmd/micro) installed directly, but it is not recommended to do this, because it does not use the version information to build micro (necessary) plug-in manager, and will not disable debug mode.

Full static binary

By default, microbinaries dynamically link the core system library (this is generally recommended for security and portability). However, a fully static pre-built binary is provided for amd64 as, linux-static.tar.gz To build a fully static binary from source code, run

CGO_ENABLED=0  make build

Usage

After building the editor, start it by running micro path/to/file.txt or micro to open an empty buffer.

micro also supports creating buffer stdin from:

ifconfig | micro

You can use the arrow keys and mouse to move the cursor.

You can also use the mouse to manipulate the text. Simply click and drag to select text. You can also double click to enable word selection and triple click to enable line selection.

Command bar

Open the command bar by pressing Ctrl-e. It is a single-line buffer, which means that all key bindings (as well as mouse and selection) from regular buffers are supported.

When running a command, you can use additional syntax that micro will extend before running the command. To use a parameter with a space, put it in quotes. The command bar parser uses the same rules to parse the arguments that /bin/sh will use (single quotes, double quotes, escape). The command bar does not look for environment variables.

Micro provides the following commands, which can be executed in the command bar by pressing Ctrl-e and typing the command. The parameters are enclosed in single quotes here, but these are not required when entering commands in micro.

  • bind ‘key’ ‘action’ : Creates a key binding from the key to the action. For more information about binding keys, see the keybindings documentation. This command will modify bindings.json and overwrite any bindings that the key already has.
  • help ‘topic’? : Opens the appropriate help topic. If no theme is provided, the default help screen opens. The help topic is stored as a.md file in the directory of the runtime/help source tree, embedded in the final binary.
  • save ‘filename’? : Saves the current buffer. If a file is provided, it will “save as” the file name.
  • quit: quit the micro.
  • goto ‘line’: Jump to the given line number. Negative numbers can be passed in to jump inwards from the end of the file; For example, -5 jumps to the fifth line from the bottom of the file.
  • replace ‘search’ ‘value’ ‘flags’? : This will replace search with value. flags is optional. Possible signs are:
    • -a: replaces all matches at once
    • -l: do a text search instead of a regular expression search
  • Note that search must be a valid regular expression (unless -l passes). If there are no Spaces in one of the arguments, the quotation marks can be omitted.

—END—

Open Source protocol: MIT license

资源下载此资源为免费资源立即下载
Telegram:@John_Software

Disclaimer: This article is published by a third party and represents the views of the author only and has nothing to do with this website. This site does not make any guarantee or commitment to the authenticity, completeness and timeliness of this article and all or part of its content, please readers for reference only, and please verify the relevant content. The publication or republication of articles by this website for the purpose of conveying more information does not mean that it endorses its views or confirms its description, nor does it mean that this website is responsible for its authenticity.

Ictcoder Free Source Code Editor Series: micro A terminal-based text editor https://ictcoder.com/editor-series-micro-a-terminal-based-text-editor/

Share free open-source source code

Q&A
  • 1. Automatic: After making an online payment, click the (Download) link to download the source code; 2. Manual: Contact the seller or the official to check if the template is consistent. Then, place an order and make payment online. The seller ships the goods, and both parties inspect and confirm that there are no issues. ICTcoder will then settle the payment for the seller. Note: Please ensure to place your order and make payment through ICTcoder. If you do not place your order and make payment through ICTcoder, and the seller sends fake source code or encounters any issues, ICTcoder will not assist in resolving them, nor can we guarantee your funds!
View details
  • 1. Default transaction cycle for source code: The seller manually ships the goods within 1-3 days. The amount paid by the user will be held in escrow by ICTcoder until 7 days after the transaction is completed and both parties confirm that there are no issues. ICTcoder will then settle with the seller. In case of any disputes, ICTcoder will have staff to assist in handling until the dispute is resolved or a refund is made! If the buyer places an order and makes payment not through ICTcoder, any issues and disputes have nothing to do with ICTcoder, and ICTcoder will not be responsible for any liabilities!
View details
  • 1. ICTcoder will permanently archive the transaction process between both parties and snapshots of the traded goods to ensure the authenticity, validity, and security of the transaction! 2. ICTcoder cannot guarantee services such as "permanent package updates" and "permanent technical support" after the merchant's commitment. Buyers are advised to identify these services on their own. If necessary, they can contact ICTcoder for assistance; 3. When both website demonstration and image demonstration exist in the source code, and the text descriptions of the website and images are inconsistent, the text description of the image shall prevail as the basis for dispute resolution (excluding special statements or agreements); 4. If there is no statement such as "no legal basis for refund" or similar content, any indication on the product that "once sold, no refunds will be supported" or other similar declarations shall be deemed invalid; 5. Before the buyer places an order and makes payment, the transaction details agreed upon by both parties via WhatsApp or email can also serve as the basis for dispute resolution (in case of any inconsistency between the agreement and the description of the conflict, the agreement shall prevail); 6. Since chat records and email records can serve as the basis for dispute resolution, both parties should only communicate with each other through the contact information left on the system when contacting each other, in order to prevent the other party from denying their own commitments. 7. Although the probability of disputes is low, it is essential to retain important information such as chat records, text messages, and email records, in case a dispute arises, so that ICTcoder can intervene quickly.
View details
  • 1. As a third-party intermediary platform, ICTcoder solely protects transaction security and the rights and interests of both buyers and sellers based on the transaction contract (product description, agreed content before the transaction); 2. For online trading projects not on the ICTcoder platform, any consequences are unrelated to this platform; regardless of the reason why the seller requests an offline transaction, please contact the administrator to report.
View details

Related Source code

ICTcoder Customer Service

24-hour online professional services