Editing text at the command line with micro
Using Tabs
A nifty feature of micro is the ability to have multiple files open at the same time. If you have one file open in micro, you can open another one in a tab by pressing Ctrl+E and then typing tab
followed by the path to that file.
The idea is more or less like the tabs you find in a graphical editor. The tabs that you have open are listed along the top of the editor, as shown in Figure 3.
You can switch between tabs by pressing Ctrl+E and then typing tabswitch
followed by the number of the tab. The numbering of tabs starts from the left: The tab furthest to the left is 1, and the numbers increment as you move right. Or, you can click on a tab with your mouse. I prefer doing the latter.
Configuration Options
One of micro's selling points is that you can configure it to make the editor work the way that you want it to. The quickest way to do that is to open the file settings.json
found in the .config/micro
folder in your /home
directory.
That file stores configuration information in a format called JavaScript Object Notation (JSON). If you're not familiar with it, JSON is a data format that both people and computers can easily read. Don't let that intimidate you. JSON uses what's called "attribute/value" pairs to store information. In micro's settings.json
file, the attribute is a configuration option and the value is often either true
or false
. Sometimes, it's a number or something else specific to an option.
Micro has 60 configuration options. Those include options to automatically save files, to automatically match braces when writing in a markup or programming language, to display line numbers or a scrollbar, or to use tabs instead of spaces.
Figure 4 shows what my (rather basic) settings file looks like.
You can find out more about the options by opening micro's command bar and typing help options
.
Adding Plugins
Micro lives up to its billing as being extensible thanks to its support for plugins. At the time of writing, there are 27 plugins [3] that you can add to the editor. Those plugins run the gamut of tasks like correcting commonly misspelled words, adding bookmarks to a file, pretty-printing code, and adding support for the Go programming language (which is the language used to develop micro).
Install a plugin by running this command in a terminal window:
micro -plugin install <name of plugin>
Let's say you want to install the aspell plugin, which checks spelling as you type. To do that, run this command:
micro -plugin install aspell
Figure 5 shows the aspell plugin in action.
Some plugins, like aspell, run automatically. Others you need to launch yourself. To do that, open micro's command bar, type the name of the plugin to run, and press Enter.
Admittedly, 27 isn't all that many plugins. There's a chance you might not find one that suits your needs. However, if you have a few chops with the Lua programming language, you can write your own plugins. There's information about that in micro's code repository on GitHub [4].
« Previous 1 2 3 Next »
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Canonical Bumps LTS Support to 12 years
If you're worried that your Ubuntu LTS release won't be supported long enough to last, Canonical has a surprise for you in the form of 12 years of security coverage.
-
Fedora 40 Beta Released Soon
With the official release of Fedora 40 coming in April, it's almost time to download the beta and see what's new.
-
New Pentesting Distribution to Compete with Kali Linux
SnoopGod is now available for your testing needs
-
Juno Computers Launches Another Linux Laptop
If you're looking for a powerhouse laptop that runs Ubuntu, the Juno Computers Neptune 17 v6 should be on your radar.
-
ZorinOS 17.1 Released, Includes Improved Windows App Support
If you need or desire to run Windows applications on Linux, there's one distribution intent on making that easier for you and its new release further improves that feature.
-
Linux Market Share Surpasses 4% for the First Time
Look out Windows and macOS, Linux is on the rise and has even topped ChromeOS to become the fourth most widely used OS around the globe.
-
KDE’s Plasma 6 Officially Available
KDE’s Plasma 6.0 "Megarelease" has happened, and it's brimming with new features, polish, and performance.
-
Latest Version of Tails Unleashed
Tails 6.0 is based on Debian 12 and includes GNOME 43.
-
KDE Announces New Slimbook V with Plenty of Power and KDE’s Plasma 6
If you're a fan of KDE Plasma, you'll be thrilled to hear they've announced a new Slimbook with an AMD CPU and the latest version of KDE Plasma desktop.
-
Monthly Sponsorship Includes Early Access to elementary OS 8
If you want to get a glimpse of what's in the pipeline for elementary OS 8, just set up a monthly sponsorship to help fund its continued existence.