I’m thinking about writing my own text editor as a hobby.
What I want the editor for
I like to keep notes and outlines on things.
I would prefer to keep my notes and outlines as plain text if I can. Plain text is an open format and the most massively well-supported data format on Earth. There are dozens if not hundreds of text editors in existence for virtually every operating system on the planet, so if you should for whatever reason lose the ability to use your favorite text editor, there’s always another one available.
But why write yet another text editor?
For one thing, I’m not 100% satisfied with most of the text editors I’ve tried so far, which are generally geared toward programmers. (I want to do coding, of course, but I also want to do other things with the editor.) For another thing, I have some ideas for features I’d like to see in a text editor. For another thing still, I’d like to have a text editor that works not just on one OS, but on all three of the major platforms — Windows, Mac OS X, and Linux. Finally, I just want to see if I can do this.
This is a list of some features I’d like to have:
- I want the ability to keep many individual notes, and I want to be able to see only the notes that match certain criteria. I want to keep all of the notes in one place — a single text file. So I want a text editor that can tell (or be told) where one note ends and the next begins.
- I also want the editor to make manipulating notes as simple as manipulating files with a file manager. (Perhaps the editor would have a display mode where notes are displayed as icons. I’ll have to think more on this.)
- I want the editor to support Unicode. Although 99.9% of my text would be plain ASCII, occasionally I’ll want to use letters with diacritics, or special symbols, or even an occasional IPA or Greek or Japanese character.
- I want the editor to save changes automatically, without altering the original file. When a file is first opened, the editor should create a working folder for the file and copy the file’s contents into the folder. (This copying should be done in a thread so that the user doesn’t have to wait for the process to finish before he can start editing.) Any changes made to the file should be saved automatically to the copy in the working folder; the original file is left untouched until the user specifies that the original should be overwritten with the working version. This also ensures that changes made will survive even if the system crashes and must be rebooted.
- I want the editor to save a history of changes into the working folder, so that changes can be undone, redone, and reviewed even after the system is rebooted.
- I want the editor to handle huge files gracefully. If the file to be edited is too big to load into memory, then the editor should copy the file’s contents into multiple smaller files, each small enough to load. This means that the editor would be able to handle files of any size (as long as the disk has enough space for a copy of the original file).
- I want the editor to make it simple and easy to create and reuse regular expressions for searches and filters. You should be able to use regular expressions like Lego blocks and piece them together to create more complex regular expressions, then give a name to the result and save it so you can use it later.
- The editor should support incremental search, so that the editor jumps to the next match for a phrase as you type in the phrase.
- I want the editor to use stylesheets. A stylesheet in this case consists of a series of rules. Each rule spells out some text to look for and the font, style, and color to use to display the text. (The font need not be monospace; you should be able to use whatever font suits you.) The text to find might be a direct match for a regular expression, or it might be whatever text lies between matches for a pair of regular expressions.
- Stylesheets should also support rules for automatic indentation, such as what indentation to apply if the current line begins with a specific character, or what indentation to apply to the new line after the user hits Enter.
- I want the editor to support different stylesheets for different sections within the same text.
- I want the editor to support elastic tabstops so that “fields” within adjacent lines are lined up in the display, so I can create “tables” on the fly.
- I want it to be easy to record, play back, write, edit, and debug macros from within the editor. I’m considering devising my own macro language for this.
- I want to be able to enter commands just by typing, or by highlighting some text in the file and pressing a key. These commands could be built into the editor, or they could be macros or external scripts.
- And of course I’ll want most of the other things that are expected in a text editor: line numbers, the ability to filter text through an external script, conversion of text from one encoding to another, easy insertion of text clips, autocomplete, and so on.
I’m sure I’ll come up with other ideas, but this is the basic feature set I want.