Screenshots
As is the practice nowadays, we show you some screenshots to wet your appetite.
These screenshots demonstrate various features implemented with Lua. No C code is used.
See here how to enable these features.
First run
If you're a newbie you'll be asked, on startup, if you want to enable all the nice feutures you see on this page. No reason not to! This lets you experiment with mc2 without configuring it first. |
Fields
You can write your own fields in Lua.
|
More fields; BiDi
These fields are aggressively cached, so it’s feasible to use them even on slow machines.
|
Visual Rename
Sometimes you wish to rename a bunch of files using some regexp. MC can do this but with MC it’s like shooting in the dark: you don’t know the names you'll end up with till you perform the rename, and then you may discover, to your dismay, that you'll be overwriting some files! Visual Rename solves this by showing you, as you type, how your files will end up. It also warns you if clashes (overwriting files) will occur. You can also rename files down a directory tree by “panelize"ing first. You may even plug in your own code. No more wasting time on writing those little shell/ruby/perl script to rename files! Also note the “Panelize” button. There’s a special mode that makes Visual Rename act somewhat like a filter-as-you-type feature. |
“Folder Jumping”
Folder jumping lets you jump over folders that contain nothing more than a single sub-folder. The feature was borrowed from GitHub.com. This is a great The screenshot at the background shows that you can use a fancy separator instead of “/”. |
Filesystems
You can write filesystems in Lua. The following naive code:
local myfs = { prefix = "myfs", readdir = function () return { "one.txt", "two.txt", "three.txt" } end, file = function (_, path) if path == "one.txt" then return "Mary had a little lamb.\nHis fleece was white as snow." end end } fs.register_filesystem(myfs)
results in:
You'll also find bundled filesystems for SQLite, MySQL and MHT. |
Editor
The editor too can benefit from scripting, as we'll see here.
Speller
A basic speller can be implemented in just 5 lines of code. The speller script shown here interacts with your actual speller via the aspell / ispell / hunspell / spell binary. Note, in the picture, that misspellings are only highlighted when they occur in comments (and string literals). We certainly don’t want “misspellings” occurring in the main code (e.g. “g_getenv”) to be highlighted. |
Linter
Linter for various languages. |
… you can also use it to conveniently browse a disassembler’s output (or whatever other tool that’s of interest to you). |
Visual Replace
Function list
Shows a menu of your functions. |
Modeline
Modeline support. |
UnicodeData.txt; ruler; scrollbar
We see three features here:
|
UnWind
Are you editing files created by Windows/DOS programmers? Let the unwind module automatically convert CR+LF to LF for you. No more distracting “^M” at line ends! It also lets you toggle visible tabs with a hotkey (as files coming from Visual Studio often use tabs). This screenshot shows the indicator it displays at the bottom-right corner:
|
“Actors”
The idea behind the “modeline” feature —of embedding meta information in the text— can be used for implementing various creative ideas. Here we've embedded the names of the characters of a novel at the start of the text. Our "actors" script then colors them up. Males are in bluish color; females in pinkish. Also shown here is our dictionary.lua script. |
User Interface
We have an elegant, easy, and yet powerful API for creating user interfaces.
A game. In this picture we also happen to be editing the source code of the game. We can edit Lua code right inside MC and then ask it to reload the Lua subsystem when we want to see the effects of our modified code. We don’t need to restart MC. Notice, in the picture, several things borrowed from the JavaScript world: set_interval and on_click. Additionally, Lua is a dynamic language, which makes it possible to use different styles of programming. Also note the scrollbar at the left. |
Creating frontends for command-line tools
While the command-line is gods' gift to mankind, it’s sometimes a drag having to revisit the manual pages to refresh your memory on how to run some programs. Dread no more! You can now create your own UI frontends. Here is one used to scan images. |
Recently Visited Files; xterm titles
Here’s a box showing you the files you've recently visited. That is, files you're currently or have recently edited or viewed. This feature saves you a huge amount of keystrokes because you no longer need to navigate among directories. There’s also a “Goto” button which makes this box an alternative to the “Directory hotlist” box. Files you're currently editing are marked with “*”. Files currectly viewed are marked with “v”. You can switch to them right from this box, which makes it also a replacement for MC’s “Screens” box. Files edited in other MC processes are marked with “!”. You can even provide your own code to alter the list. E.g., you can add there files edited in Vim or gedit. Or you can populate it with all the files in your project. You also see here alternative xterm titles. Note the terminal’s three tabs: MC’s builtin xterm titles would have wasted precious space. Here we have “[M] /path/to/dir” shown for the filemanager, and “[E] edited-file.txt” for the editor. You may customize this. E.g., you can add the process ID to the title. Note that we're editing the “TODO” file in the left tab. Indeed, our Recently visited files box indicates (with a “!”) that this file is being edited by another process. |
Snapshots
Want to save the state of your panels? You have it: snapshots. This feature is somewhat like tabs, and somewhat like the “Directory hotlist”. Note the “sb” snapshot, which doesn’t record a directory (indicated by
The “p” snapshot, on the other hand, records nothing but directory
paths (indicated by a missing In the “radio” snapshot one (or both) of the panels is panelized
(indicated by the |
Tabs
You want tabs? You've got them. |
Calculator
Tired of running Here’s the solution. A calculator. You're not limited to math formulas: any Lua expression works. |
Find-as-you-type; hotkeys; clock
This image shows three accessories:
(“broo” matches “Brooks” because the search is case insensitive unless you type an uppercase letter. If the search string isn’t found, the “Search” box is painted in alert colors (typically red).)
|
Docks
You can inject your own widgets into the filemanager (this is just a “by product” of our fine user interface API). The ticker module injects widgets that show you the output of shell commands and have this display updated every X seconds. In this picture we see two tickers. The top one (the reddish) shows some RSS feeds. The bottom one (the khaki) shows a random line from a text file (useful for people learning some [human] language and needing to improve their vocabulary, for example). The user can easily improvise a clock by using a ticker, but there’s already one. Some other potential uses for this ability:
|
Access-warning
We can inject widgets to the editor too. Here we use this ability to inject, besides a scrollbar, a label warning you about files you won’t be able to save. It also makes the editbox read-only in such cases. (This label, as the scrollbar, doesn’t come on top of the text: it’s docked south of it.) |
Scrollbar; filter-as-you-type
We see two features here:
Unlike MC’s useless non-proportional listbox scrollbar, this scrollbar is proportional (same is true for the scrollbar in the editor).
|
Restore selection
Imagine that you find out that the USB stick you copied a few files to was accidentally formatted. You use the restore selection feature to go back in time and re-select those files so that you can copy them again. |
Various accessories
Will the four files on the left, weighting “1,857,302K bytes” fit in the “1,819” MiB free space on the right? You're not sure. Thankfully, Size calculator says your files consume just “1,813.77 MiB”. Hurrey! They will fit! |
Screensavers
A screensaver showing an analog clock (indicating 12:38:26). |
Standalone mode
You can run scripts from the command line. You don’t have to be “inside” MC. Let’s see some examples.
HTMLizer
The htmlizer uses the syntax highlighting support of MC’s editor to convert source files to HTML. |
User interface
You can use the UI even in standalone mode…
We've seen this game earlier. Here we see it used “outside” MC. |
…which makes standalone mode an ideal replacement for dialog(1) and zenity(1).
More…
There are many useful scripts bundled that aren’t mentioned here. Go ahead and experiment!
skip-toc