1.7 KiB
it
UNIX ed for a new age...
Just kidding, no need to use this over ed. This is just my take on a line editor, heavily inspired by ed.
For disambiguation it's suggested that this project be referred to as "ited", pronounced however one likes (suggested: "iht-ehd").
Included commands
!
Passes arguments to Python subprocess.run
.
buffer
This is where code relating to the Buffer class is kept but calling this from within the editor will allow you to view the current buffer's attributes.
dot
Change the current position within the buffer.
exit
Will exit via sys.exit rather than telling main.py to break out of the main loop. Functionally identical to Q
.
f
Displays or changes the filename associated with the current buffer.
it
Launches a new instance of it
.
It should be noted that quitting a nested instance of it
through the usual means (exit
, q
, or Q
) will exit all nested instances of it
as well.
To return to a higher instance of it
, send an EOF character via your terminal. In xterm this is CTRL+d.
load_module
Manually loads a module, whether or not it was already loaded.
parse_command
Used by it
's main Python module but calling this from within the editor will allow you to test the command argument splitting.
Q
Quits.
q
Quits, unless your current buffer is unsaved.
saved
With no arguments given, flips the buffer's "saved" boolean attribute. Otherwise, sets the buffer's "saved" attribute to the first argument or errors if multiple arguments given.
version
Prints the versions of given modules. If no modules are specified, prints the version of module "it".
Making new commands
Making new commands is very easy.
Read buffer.py
and it.py
(<100 LOC total).