SkillAgentSearch skills...

Edna

ed-like text editor

Install / Use

/learn @rnoth/Edna
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

edna is a work in progress text editor inspired by the UNIX standard, ed.

at the moment edna has some features, but not quite at odds with ed(1) itself. edna has all of ed's line insertion commands

- `a' will enter insert mode, appending lines after the current
- `i' will enter insert mode, inserting lines before the current
- `c' will delete the current line, and insert lines in place of the
      deleted

(note that edna uses a single period on a line by itself to exit insert mode)

e.g.

% edna :i int main() { return 0; } . :


among the commands are also: - d' to delete the current line - h' to explain the last error - `p' to print the current line

there is also support for multiple buffers: - o' opens a delimitted list of files in new buffers - b' lists the all the opened buffers - next' focuses the next buffer - prev' focuses the previous buffer

finally: - f' to print or change the default filename - w' to write the contents of the buffer - e' to re-open the current file, or edit a new file - q' to free the buffer and exit successfully

q' has two variations - wq' to a write and quit - `Q' to quit unconditionally

if edna is given a list of files as it's arguments, they are read into memory as buffers, and written back out on w' and wq' commands

edna has a config.h'' header file, which allows configuring a few options: - the `PROMPT' macro is expanded and printed before a command is read from stdin. it defaults to ':', but it is fed into printf(3), allowing some flexibility. the "%ld:", bufgetpos(buf)'' prompt is quite handy, for instance - the INS_PROMPT' macro is expand and printed before a line is read from stdin when in insert mode. - the ERROR' macro is expanded and printed when a command fails in some way. following ed(1), edna defaults to the inscrutable "?\n", but you may find ``"%s\n" error'' more helpful. don't forget the newline!

config.c primarily contains the arrays for commands and modes, to prevent them from being re-defined everytime config.h is included - the commands' array is indexed when a command is read from stdin. it has a four fields: - name', a string handle to identify the command both to the user and edna - func' a pointer to function to be executed, - mode', a string which allows extra context to be given to the function. - defaddr', the default line address of the command - the modes' array is indexed when a command tries the change the mode, it has six fields: - name', the name of the mode - init', currently unused - prompt', executed first - input', executed second - parse, executed last if any of these commands return failure, the sixth member is called: - error', the error handler

at the moment, there are two modes, `command', and `insert'.

planned features: - regex support - registers - line marks - macros - more standard ed commands (m',t',`x', etc.) - undo trees - command chaining - plugin support

Related Skills

View on GitHub
GitHub Stars17
CategoryDevelopment
Updated3mo ago
Forks0

Languages

C

Security Score

87/100

Audited on Dec 26, 2025

No findings