the best environment for the synthesis of text

(a draft, like everything else)

name

best - text manipulation environment for vt100

synopsis

best [file ..]

description

best is an environment for synthesizing text. it acts as an interface to external programs which use the stdio paradigm. its biggest inspiration is the acme editor, but it runs in a vt100 terminal and is modal rather than mouse-oriented.

best is an exercise in restraint. it should not be configured itself, and does not provide much opportunity to do so. best exposes some simple concepts and lets you make use of them in various ways.

windows

files and other output are shown in windows, which are made up of a tagline and a body. the body holds the content of the file or output. the tagline holds some information about the file.

the leftmost character of the tagline is an asterisk if the body has been changed since being written to disk, a dash if it is up to date, and a percent if the body does not have a corresponding location on disk.

the next item in the tagline is the path. if the window holds a file or directory, it will be its absolute path. if it holds a directory, a slash will be appended to the path. if the window holds output, the path will be the absolute path to a special file +Errors in the pwd.

the path may have a colon appended, and be followed by two sets of coordinates separated by a dash. these refer to the point and the mark respectively. the point comes first, but does not have to come before the mark in the file.

navigation

layout

windows are arranged in columns.

columns and buffers can be resized somewhat dynamically. columns are positioned according to their left-side coordinate, which is given in terms of terminal cells or 0s. buffers are positioned according to their top-side coordinate, which is given in the same terms.

windows can be moved between columns. when this happens, the y value of the window's tagline is taken into account, and kept the same where possible.

top bar

the top bar holds text that can be executed with M-N by default, that is the meta key and a character. the format is as follows:

[1] Save   [2] Newcol

keybindings are derived by looking for an opening square bracket followed by a character followed by a closing square bracket. the environment used is that of the current window.

do what i mean

when the user presses return, the current region is passed as the first argument to a 'dwim' script on the path. this can be written to do anything, but the idea is that it acts as a universal hyperlink. pressing return with a filepath selected may open it in best, for example, while a region beginning with "!w " may print the wikipedia page for the search term following.

completion

best has a simple completion system inspired by emacs's hippie-expand. when it is called, it checks if the preceding string looks like a path. if so, it completes to the next file or directory name, and cycles through possiblities. if not, it consults a list of words from open windows, files in the current directory, commands in the path, and environment variables, and cycles through them.

search

there is no regular expression search functionality, because grep exists. instead, the user can navigate to the next, or to the previous, occurence of the current selection. a pseudo-selection may be read to start off the process, akin to a search prompt.

navigation

navigation is performed using word objects. these make some operations, like character-by-character movement, more difficult, with the intent of pushing the user to act in larger semantic units.

selection

selection works the same as navigation. when the shift key is held (or caps lock is active), navigation commands move the point, but leave the mark where it is, expanded the selection.

window management

the user can navigate between the columns with keybindings. the shifted versions of these keys take the current window between columns.

scrolling

windows scroll like emacs windows. a context line is allowed at the top and the bottom, and once reached, the point is repositioned to be at the middle of the window.

saving

each window is automatically saved frequently. the user should not compulsively type the key strokes to save a file.

backups

saving so frequently means it is worth backing up frequently.

best has functionality for autosaving backups that cannot be disabled without recompiling. the files are stored in a central location ( $XDG_CACHE_HOME/best/backups) which replaces slashes with exclamation marks and appends a time stamp. so the file /home/noah/todo.txt would get backed up to $XDG_CACHE_HOME/best/backups/!home!noah!todo.txt.2020-09-04-15-11-34 if the backup happened at around ten past three in the afternoon on the fourth of september, 2020. this ordering puts versions of the same file in a row, rather than providing a chronological view of when the user was editing what. files are backed up every twenty characters by default.

undo

undo walks backward through a file's backups. or something.

tab

the tab key inserts a tab.

macros

macros work on file lines. this is so that if one line goes longer than the rest of the lines and wraps around, the behaviour that i have found to be the preferred behaviour almost every time takes place. for example, if i am going down lines and replacing the starting " - " with "

  • ", if one list entry is long enough to wrap to the next line i don't want it to be changed to a separate list item.

    environment

    best inherits the environment when starting, but has some variables of its own:

    if a directory $XDG_CONFIG_HOME/best/bin exists, it is prepended to the $PATH variable. this allows scripts such as Save and Newcol, which do not serve much purpose outside of best, to be easily accessed.

    keybindings (proposed)

    keybindings are sent to the best process via a client command, which allows interaction with the interface to be manipulated and scripted.

    origins of the name

    best grew out of a previous text-editing program i wrote, called alicia, ostensibly named after alicia keys for its keyboard driven nature, but actually named after alicia silverstone because in the editing world my offering had all the worth of a virgin who couldn't drive.

    at some point i decided i wanted to change the name, though i cannot remember my exact thought process or a date. i guess the current concepts were distinct enough from the original that it seemed worthwhile, or something. anyway, "best" is of course a backronym, and "best" was chosen mostly to make it difficult to search for, though i guess it might also help incite flamewars?

    limitations

    best has no syntax highlighting. this is a semi-elitist choice. mostly it derives from the fact that i personally haven't noticed such a drop in my productivity, nor such an increase in my productivity, when not using or using syntax highlighting, to warrant the significant increase in complexity that it brings.

    best has no mouse support. this is a client issue, not a best issue though, and if a client is developed that uses the mouse, there will be no problem. the vt100 implementation will not have mouse support, because uh... the vt100 didn't have a mouse.

    best has no support for language-aware editing, editorconfig, or the language-server protocol.

    best does not embed a scripting language. one of the core concepts is to make use of external processes and languages. to add a language would be counter-intuitive.