2

Install and Use Micro terminal text editor on Rocky/AlmaLinux 8

 2 years ago
source link: https://computingforgeeks.com/install-and-use-micro-terminal-text-editor-on-rocky-almalinux/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Install and Use Micro terminal text editor on Rocky/AlmaLinux 8

Text editors are used for editing text files(config files), writing code, creating instructions e.t.c. They are divided into two major categories i.e command line text editors such as Vim, Jed, nano, and GUI-based text editors such as Gedit, Emacs, Kate, gVim, Leaf pad, Notepad++ e.t.c.

Micro is a modern command line text editor written in Go language and is supported on Windows, Linux, and macOS systems. This text editor is preferred over other editors due to its simplicity, ease of use, and intuitiveness.

Micro aims to be the best around the clock by offering more amazing features such as:

  • It is easy to use and install.
  • nano-like menu to help you remember the keybindings.
  • Extremely good mouse support with dragging to create a selection, double click to select by word, and triple click to select by line.
  • Simple autocompletion.
  • Supports syntax highlighting for over 90 languages! And so much more..
  • Color scheme support with 16, 256, and true color themes by default.
  • Copy and paste with the system clipboard.
  • Easy to configure.
  • True color support
  • Supports automatic listing and error notifications.
  • Supports splits and tabs.
  • Supports multiple cursors.

By following this guide to the end, you should be able to install and use the Micro terminal text editor on Rocky/AlmaLinux 8.

Install Micro terminal text editor on Rocky/AlmaLinux 8

In this guide, I will cover the following method on how to install Micro terminal text editor on Rocky/AlmaLinux 8:

  • Using the DNF package manager
  • Using an Installation Script
  • Using Snap

Option 1 – Install Micro terminal text editor on Rocky/AlmaLinux 8 using DNF

Micro can be easily installed on Rocky/AlmaLinux 8 using DNF. Begin by adding the EPEL repository to your system.

sudo dnf install epel-release

Once the repository has been added, install micro using the simple command below.

sudo dnf install micro

Dependency Tree:

Dependencies resolved.
================================================================================
 Package         Architecture     Version                  Repository      Size
================================================================================
Installing:
 micro           x86_64           2.0.6-1.el8              epel           4.7 M

Transaction Summary
================================================================================
Install  1 Package

Total download size: 4.7 M
Installed size: 17 M
Is this ok [y/N]: y
.....

Accept the key importation.

Importing GPG key 0x2F86D6A1:
 Userid     : "Fedora EPEL (8) <[email protected]>"
 Fingerprint: 94E2 79EB 8D8F 25B2 1810 ADF1 21EA 45AB 2F86 D6A1
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-8
Is this ok [y/N]: y
....

That is it! You have successfully installed the Micro terminal text editor on Rocky/AlmaLinux 8 using DNF.

Option 2 – Install Micro terminal text editor on Rocky/AlmaLinux 8 using an Installation Script.

There is an alternative method to use when installing the Micro terminal text editor on Rocky/AlmaLinux 8.

First, install cURL on Rocky/AlmaLinux 8

sudo dnf install curl

Now download the bash script as below.

curl https://getmic.ro | bash

Sample Output:




 __  __ _                  ___           _        _ _          _ _
|  \/  (_) ___ _ __ ___   |_ _|_ __  ___| |_ __  | | | ___  __| | |
| |\/| | |/ __| '__/ _ \   | || '_ \/ __| __/ _\ | | |/ _ \/ _  | |
| |  | | | (__| | | (_) |  | || | | \__ \ || (_| | | |  __/ (_| |_|
|_|  |_|_|\___|_|  \___/  |___|_| |_|___/\__\__,_|_|_|\___|\__,_(_)

Micro has been downloaded to the current directory.
You can run it with:

./micro

Now move the downloaded file to your path.

sudo mv micro /usr/bin

At this point, you have Micro already installed. Check the installed version.

$ micro -version
Version: 2.0.10
Commit hash: b9763856
Compiled on August 07, 2021

Option 3 – Install Micro terminal text editor on Rocky/AlmaLinux 8 using Snap.

Micro also exists as a snap package. Before we install it, ensure that snap is installed and running on your system.

sudo dnf install epel-release
sudo dnf install snapd

Start and enable the snap service.

sudo systemctl enable --now snapd.socket
sudo ln -s /var/lib/snapd/snap /snap

Use Snap to install the Micro terminal text editor on Rocky/AlmaLinux.

sudo snap install micro --classic

Sample Output:

Setup snap "core" (12603) security profiles                                    \
2022-02-15T02:38:30-05:00 INFO Waiting for automatic snapd restart...
micro 2.0.10 from Zachary (zy) installed

Now export the snap path.

echo "export PATH=$PATH:/snap/bin" >> ~/.bashrc
source ~/.bashrc

Verify the installed version.

$ micro -version
Version: 2.0.10
Commit hash: b976385
Compiled on August 07, 2021

Use Micro terminal text editor on Rocky/AlmaLinux 8

Once installed using any of the above methods, proceed and use the Micro terminal text editor on Rocky/AlmaLinux 8 as below.

1. Create a text file.

To create a text file using Micro, issue the command with the syntax below.

$ micro <text file>

For example to create a simple file test.txt, proceed as below.

micro test.txt

Micro will be launched as below.

To save the file, press CTRL + S, and exit using CTRL + Q. You can also get help when using Micro by pressing CTRL + G

2. Micro Built-in Command Bar

Micro has an in-built Commandline bar with which you can modify parameters, perform split and tabs e.t.c.

This command line can be opened using CTRL + E

Micro Keybindings

Now try typing your command for example to get the list of default keybindings use the command:

> help defaultkeys

Sample output:

Remember, you can also edit the bindings.json files to create custom key bindings under ~/.config/micro/bindings.json

Set Micro Color Scheme

Still in the command line, set the Micro Color Scheme using the syntax below.

> set colorscheme <themename>

There are inbuilt dark and light themes. Get the list of themes by pressing TAB after set colorscheme

Micro Splits

From the command line, you can perform both horizontal and vertical tab splits using the syntax:

> hsplit filename    # Horizontal split
> vsplit filename    # Vertical split

For example.

> hsplit test.txt

Sample output:

You can also view all the Micro text editor usage options as below.

$ micro --help
Usage: micro [OPTIONS] [FILE]...
-clean
    	Cleans the configuration directory
-config-dir dir
    	Specify a custom location for the configuration directory
[FILE]:LINE:COL (if the `parsecursor` option is enabled)
+LINE:COL
    	Specify a line and column to start the cursor at when opening a buffer
-options
    	Show all option help
-debug
    	Enable debug mode (enables logging to ./log.txt)
-version
    	Show the version number and information

Micro's plugin's can be managed at the command line with the following commands.
-plugin install [PLUGIN]...
    	Install plugin(s)
-plugin remove [PLUGIN]...
    	Remove plugin(s)
-plugin update [PLUGIN]...
    	Update plugin(s) (if no argument is given, updates all plugins)
-plugin search [PLUGIN]...
    	Search for a plugin
-plugin list
    	List installed plugins
-plugin available
    	List available plugins

Micro's options can also be set via command line arguments for quick
adjustments. For real configuration, please use the settings.json
file (see 'help options').

-option value
    	Set `option` to `value` for this session
    	For example: `micro -syntax off file.c`

Use `micro -options` to see the full list of configuration options

Conclusion.

That is the end of this brief guide on how to install and use the Micro terminal text editor on Rocky/AlmaLinux 8. How do you find this text editor in comparison to your favorite text editor(nano, vim)? Let us know in the comments below.

See more:


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK