Linux 10 min read

e3: The One-Floppy Editor with Multiple Personalities

Suresh S Suresh S
e3: The One-Floppy Editor with Multiple Personalities

In the vast and often contentious world of Linux terminal text editors, developers are fiercely loyal to their chosen tools and the keybindings that govern them. Vi and Neovim users despise the complex finger gymnastics required by Emacs. Emacs users scoff at the modal editing constraints of Vi. Meanwhile, beginners and those who just want to make a quick tweak to a configuration file often default to Nano, much to the chagrin of power users who view it as too simplistic.

This deep-rooted muscle memory creates a genuine problem for system administrators. When you deploy a fleet of servers or build a custom rescue disk, which editor do you install to ensure that any technician logging in will be able to comfortably edit files?

What if there was a single, microscopic text editor that could magically morph its entire interface and keybinding schema to please everyone, regardless of what operating system they were using or what muscle memory they had developed?

Meet e3 (Editor for Everything).


1. The Ultimate Portable Editor: An Architectural Marvel

Before we dive into how to use e3, we must understand how it exists, because the engineering behind it is nothing short of incredible.

Modern text editors, even terminal-based ones, are large. They rely on standard C libraries (like glibc), terminal handling libraries (like ncurses), and potentially runtime environments. This makes them relatively bulky and prone to dependency issues if you attempt to copy the compiled binary from an Ubuntu machine to a CentOS machine.

e3 is entirely different. It is written purely in Assembly Language (specifically, x86 and x86_64 assembly, typically compiled via NASM - the Netwide Assembler).

Bypassing the C Standard Library

By writing the editor in pure assembly, the developer (Albrecht Kleine) completely bypassed the C Standard Library. Instead of calling standard C functions like printf() or fopen(), e3 communicates directly with the Linux Kernel using direct System Calls (syscalls).

This architectural choice has massive implications:

  1. Microscopic File Size: The compiled executable binary for e3 usually weighs less than 30KB. You can literally fit hundreds of copies of this editor on a single vintage 1.44MB floppy disk.
  2. Zero Dependencies: e3 requires absolutely no external libraries. It doesn’t need libc, ncurses, or anything else. If the Linux kernel is running, e3 will run.
  3. Universal Portability: Because it interacts directly with the kernel’s syscall interface, you can compile e3 on one Linux distribution, copy the 30KB binary to a USB drive, and it will flawlessly execute on practically any other Linux distribution in existence, from Arch to Ubuntu to an embedded Yocto build.

2. The Five Personalities of e3

The defining feature of e3 is its ability to instantly swap its keybinding schema to emulate five completely different classic text editors. It does this without requiring you to download plugins or swap configuration files. The logic for all five editors is baked directly into that 30KB executable.

You can launch e3 into a specific mode by passing a flag in the terminal when you start the program.

A. WordStar Mode (e3 -w or e3ws)

This is the default mode of e3. WordStar was a highly influential word processor from the CP/M and early MS-DOS era. While the keybindings might seem archaic to modern users, they were heavily optimized for touch typists who did not want their hands to leave the home row. It relies heavily on the “Ctrl” key (known as the “WordStar Diamond” for navigation: Ctrl-S, Ctrl-D, Ctrl-E, Ctrl-X).

B. Pico / Nano Mode (e3 -p or e3pi)

This mode emulates the classic UW Pico editor, which was the predecessor to GNU Nano. This is the most beginner-friendly mode. All commands are executed using Ctrl modifiers, and the bottom of the screen displays a helpful menu of the available commands, exactly like Nano.

C. Emacs Mode (e3 -e or e3em)

For the chord lovers. Launching e3 in this mode transforms it into a mini-Emacs. It supports standard Emacs navigation (C-n, C-p, C-f, C-b), file operations (C-x C-s to save, C-x C-c to quit), and even a rudimentary version of the Emacs Kill Ring for cutting and pasting text.

D. Vi Mode (e3 -v or e3vi)

For the modal editing purists. In Vi mode, e3 behaves like the classic vi editor. You start in “Normal” mode, where pressing keys executes commands (like dd to delete a line). You must press i or a to enter “Insert” mode to actually type text, and press Escape to return to Normal mode. You save and quit using standard ex commands like :w and :q.

E. Nedit Mode (e3 -n or e3ne)

Nedit mode is designed to emulate standard GUI-based text editors that follow the CUA (Common User Access) standard. If you are used to Windows Notepad or basic graphical Linux editors, this mode allows you to use standard shortcuts like Ctrl+C to copy, Ctrl+V to paste, and Ctrl+S to save.


3. Dynamic Mode Switching: The Alt+K Magic

While you can specify the mode when launching the program, e3 possesses an incredible hidden feature: dynamic personality switching.

While you are actively editing a document, regardless of what mode you started in, you can press Alt + K (or Meta + K).

This command will instantly cycle the editor through its five personalities in real-time. The status bar at the bottom will flash to indicate the new mode.

This is profoundly useful in collaborative troubleshooting scenarios. Imagine you are screen-sharing with a colleague to debug a server. You open the file using Vi keybindings because you prefer them. You navigate to the problematic line, but your colleague (who only knows Nano) says, “Let me drive.” Instead of saving the file, closing the editor, and reopening it in Nano, you simply press Alt+K a few times until the Nano menu appears at the bottom of the screen, and hand over control.


4. Basic Usage Guide: Pico Mode as an Example

Because e3 literally changes how it works based on the mode you are in, providing a universal usage guide is impossible. How you save and quit depends entirely on your current personality.

However, since Pico/Nano mode is the most universally understood, let’s look at a typical workflow using e3 -p.

Launching the Editor

To open a file (or create a new one) in Pico mode, run:

e3 -p /etc/hostname

The Interface

You will immediately notice a familiar sight. The text is in the upper portion of the terminal, and the bottom two lines are dedicated to a command menu (e.g., ^O WriteOut, ^X Exit).

Essential Commands in Pico Mode

  • Ctrl + O (WriteOut): Save the file. e3 will prompt you to confirm the filename at the bottom of the screen. Press Enter to confirm.
  • Ctrl + X (Exit): Quit the editor. If you have unsaved changes, it will prompt you Save modified buffer? (Y/N).
  • Ctrl + K (Cut Text): Cuts the entire current line and stores it in the clipboard buffer.
  • Ctrl + U (Uncut / Paste): Pastes the text from the clipboard buffer into the current line.
  • Ctrl + W (Where Is): Initiates a text search. Type your search string and press Enter.

Note: Even while in Pico mode, e3 retains a few of its own universal shortcuts. For example, the Alt+K mode toggle is always active.


5. Compiling and Installing from Source

Because e3 is written in assembly and makes direct kernel syscalls, it is rarely included in the default repositories of distributions like Ubuntu, which prefer to ship dynamically linked C programs. Therefore, installing e3 is usually done by compiling it from source.

Compiling an assembly program is a slightly different process than compiling a standard C application with gcc.

Prerequisites

You need an assembler. The e3 source code is written for nasm (the Netwide Assembler).

# On Debian / Ubuntu
sudo apt update
sudo apt install nasm make git

# On Fedora / RHEL
sudo dnf install nasm make git

The Compilation Process

Step 1: Download the Source Download the latest e3 source code archive (often hosted on legacy Unix software mirrors or mirrored on GitHub repositories). Extract it and navigate into the directory.

git clone https://github.com/ExampleMirror/e3.git
cd e3

Step 2: Assemble and Link Unlike complex C programs that require running ./configure, e3 is so simple that you only need to run make.

The Makefile will instruct nasm to assemble the .asm files into object files (.o), and then it will use the standard linker (ld) to link them into the final executable.

make

This process will take less than 100 milliseconds.

Step 3: Installation and Symlinking You now have a binary named e3. Move it to your system binaries directory:

sudo mv e3 /usr/local/bin/
sudo chmod +x /usr/local/bin/e3

The Symlink Trick: e3 utilizes a classic Unix trick. When a program executes, the kernel passes it an array of arguments (argv). The very first argument (argv[0]) is the name of the command that was typed by the user to invoke the program.

e3 reads argv[0]. If it sees that you typed e3vi, it automatically starts in Vi mode. If it sees e3em, it starts in Emacs mode.

To take advantage of this, you should create symbolic links to the main executable:

cd /usr/local/bin
sudo ln -s e3 e3vi
sudo ln -s e3 e3em
sudo ln -s e3 e3pi
sudo ln -s e3 e3ws
sudo ln -s e3 e3ne

Now, instead of typing e3 -v filename.txt, you can simply type e3vi filename.txt.


6. Permanent Configuration via Environment Variables

Most text editors use hidden configuration files (like ~/.vimrc or ~/.nanorc) to store user preferences. e3, true to its extreme minimalist nature, does not. Writing parser logic to open a file, read strings, and interpret configuration directives would require too much assembly code and bloat the binary size.

Instead, e3 reads Environment Variables directly from the Linux shell. This is a brilliant, zero-overhead way to manage configuration.

If you want to customize e3 permanently, you add export declarations to your shell’s profile (e.g., ~/.bashrc or ~/.zshrc).

Key Environment Variables

  • E3MODE: Defines the default personality e3 should assume if no flag is passed.
    • Valid options: ws (WordStar), pi (Pico), em (Emacs), vi (Vi), ne (Nedit).
  • E3TABS: Defines the visual width of a tab character. The default is 8, which is often too wide for modern code.
  • E3AUTOINDENT: When set to 1, pressing Enter will automatically apply the same leading whitespace as the previous line (vital for editing YAML or Python).

Example Configuration

To configure e3 to always act like Nano, with 4-space tabs and auto-indentation enabled, open your ~/.bashrc file (ironically, you can use e3 to do this) and append the following lines:

export E3MODE=pi
export E3TABS=4
export E3AUTOINDENT=1

Save the file and run source ~/.bashrc to apply the changes. From now on, simply typing e3 filename will launch your customized Pico environment.


7. Conclusion

In an era where text editors are increasingly built on top of massive web-browser rendering engines (like Electron) and consume gigabytes of RAM to edit plain text, e3 stands as a monument to efficient software engineering.

Writing an editor capable of mimicking five entirely different paradigms in under 30KB of pure Assembly language is a guide in optimization. While you are unlikely to use e3 to write a massive enterprise software application, its sheer utility in rescue environments, embedded systems, and containerized deployments makes it an invaluable tool.

It proves that software doesn’t need to be bloated to be versatile. The next time you build a custom rescue disk or a minimal Alpine Linux container, drop the e3 binary into the /bin directory. You will rest easy knowing that regardless of who ends up logging into that shell—be they a Vim veteran, an Emacs enthusiast, or a Nano novice—they will feel right at home.

Frequently Asked Questions (FAQ)

What is the e3 text editor?

e3 is a microscopic, portable terminal text editor written purely in assembly language. It is incredibly small (under 30KB) and has zero dependencies, making it universally portable across almost any Linux distribution.

How many different editing modes does e3 support?

e3 can emulate five distinct classic text editors: WordStar, Pico/Nano, Emacs, Vi, and Nedit. The logic for all these modes is built directly into the single executable.

How do I switch editor personalities while using e3?

While actively editing a document, you can dynamically switch between e3’s five different personalities in real-time by pressing the Alt + K (or Meta + K) keyboard shortcut.

Why is e3 so much smaller than standard text editors?

e3 bypasses the C Standard Library and terminal handling libraries like ncurses. Instead, it interacts directly with the Linux Kernel using system calls, resulting in its exceptionally small file size and lack of dependencies.

Can I permanently configure e3 to always open in my preferred mode?

Yes, you can permanently configure e3 by setting environment variables in your shell profile (like ~/.bashrc). For example, exporting E3MODE=pi ensures e3 will always launch in Pico/Nano mode by default.

Suresh S

Written by Suresh S

Systems Engineer & Tech Educator with 8+ years of experience in Linux Administration, Cloud Computing, and Cybersecurity. Founder of FreeTechLearner, dedicated to creating practical tutorials that help students and professionals build real-world skills.

Share this post:

Discussion

Loading comments...