status line

by adamantpenguin
See Code Download Embed
A customisable Vim-like status line with keybinds, modes and commands

Please read the whole notes

Uses my 'event system' blocks

Built in modes are:
NORMAL - keypresses are consumed by status line for triggering keybinds
PROMPT - special mode used while entering text directly into status line, such as the command prompt
While in a custom mode (not one of the above) you can always get back to NORMAL by pressing Escape

Built in commands are:
mode - switch mode
err - display last command error
h - trigger event 'statusline-help' with param 1 as the help topic ('default' if not given)
prompt - show a prompt with parameter 1 being the prompt text and param 2 being the callback event (such as 'statusline-exec')
clear-queue - clear the event queue

Built in keybinds are:
: - 'prompt : statusline-exec'

By default the left hand side shows the mode, and the right hand side shows a short status message. The status works like this:
type> message queue
where type is !, ? or = for error, unknown and result respectively; message is a short note to accompany type; and queue is [!] if the event queue is not empty, and nothing otherwise.
If you are typing a keybind, the status will instead show this:
keys queue
where keys is what you have typed of the keybind so far.

To demonstrate how this can be extended, Stage has some scripts which add a custom command ('demo-cmd'), keybind ('test') and mode ('DEMO'). There is also a 'demomode event receiver' sprite which responds to keypresses while in DEMO mode.

If you want to use this yourself, probably the easiest way is to make a copy of this project. However you could also import my 'event system' blocks module as well as the 'Catch errors' library, then import the 'status line' sprite from this project, and optionally the helper blocks in the 'status line' custom blocks category.

Created February 11, 2022

Last updated February 18, 2022

Published February 18, 2022