Back to all projects

plaintext-writer

A distraction-free text editor for writers, written in Java with JavaFX. It has no menus. You type short commands such as save or theme dark into a command line instead.

Overview

plaintext-writer is a text editor built around one rule: keep it simple. There is a column of text, and nothing else on the screen. No toolbar, no menus, no dialog boxes. When you need to do something, you open a small command line with Ctrl + Shift + H, type a command, and hide it again.

I wrote it for my own use. It is a JavaFX application in about 2,000 lines of Java.

The editor in its light theme, showing a column of monospaced text on a pale background.

The same editor in its dark theme.

The commands

The command line covers what a menu would: new, open, save and saveas for files, theme to change the look, set_width and set_fontsize to change the layout, and top and bottom to jump around. hide, show and update control the optional status items. The README has a table with an example for every command.

How it’s put together

Every command is its own class. They all extend an abstract Command class, which gives each one a name and requires three things: what the command does, a message for when it works, and a message for when it doesn’t. A command manager looks a command up by name, and a parser splits what you typed into pieces. The parser knows about quotation marks, so a file path with spaces in it stays in one piece. Adding a command means writing one new class and registering it.

The themes work the same way. Each one is a plain CSS file, and there is a template.css that explains which settings can go in a theme and which have to be handled in code. The editor comes with several themes, including light, dark, hacker and relaxed, and a new one is just a copy of the template.

The repository includes two built JAR files, so you don’t have to compile anything to try it.

Where it stands

I stopped using it, and the README says so. It also says that the file commands don’t warn you about unsaved changes, because I’d rather the limits were written down than discovered.