#line-editor #editor #ed #save-file

bin+lib sued

shut up editor - a stateless vector-oriented command-based text editor written in Rust

48 releases (19 breaking)

new 0.21.0 Nov 14, 2024
0.19.2 Nov 11, 2024
0.16.1 Nov 8, 2023
0.10.7 Jul 30, 2023

#54 in Text editors

Download history 14/week @ 2024-09-23 41/week @ 2024-09-30 115/week @ 2024-11-04 898/week @ 2024-11-11

1,013 downloads per month

Apache-2.0

93KB
1.5K SLoC

sued - shut up editor

[!NOTE] This page is about sued as a text editor. For sued as a library, see README.lib.md.

sued is a stateless vector-oriented command-based text editor written in Rust, with focus on speed, simplicity, ease of use and staying the hell out of your way. It's inspired by more contemporary editors, such as the ed family (ed, em, ex, vi, Vim, Neovim, etc.).

No, it's not "super user editor", or an editor that will sue you. It's "soo-ed", "shut up editor".

To be clear, it's a text editor that works on Rust's Vec type. To be clearer, it's a text editor that works on lines and isn't graphical, like you're probably used to.

Yes, I know ed doesn't use vectors, shut up

sued v0.13.2 - put that mouse AWAY
type ~ for commands, otherwise just start typing
sued can even run inside a readme!
jk this is just a copied-and-pasted terminal session
~show
1│sued can even run inside a readme!
2│jk this is just a copied-and-pasted terminal session
~sub 2 jk/just kidding
~show
1│sued can even run inside a readme!
2│just kidding this is just a copied-and-pasted terminal session
~clear
print("sued is fricking awesome " * 5)
~runhere python
running C:\Users\sonic\AppData\Local\Programs\Python\Python311\python.exe
sued is fricking awesome sued is fricking awesome sued is fricking awesome sued is fricking awesome sued is fricking awesome 
finished running python
# I didn't even need to save the file to do that
~show
1print("sued is fricking awesome " * 5)
2# I didn't even need to save the file to do that
~search save
line 2: # I didn't even need to save the file to do that
~save damn-thats-cool.py
saved to damn-thats-cool.py
~exit

Written in Rust, because frick you, that's why.

Obtaining

First of all, you need Cargo. If you don't have Cargo, install Rust. If you don't want to install Rust, frick off and use a different editor.

Run

# Make sure you specify `--features=repl` otherwise you won't be able to
# use the editor
cargo install sued --features=repl

and make sure that ~/.cargo/bin/ is in your PATH or you won't be able to run it.

If you'd rather install from source:

git clone https://codeberg.org/AeriaVelocity/sued.git
cd sued
cargo install --path . --features=repl

Documentation

sued's documentation is present online in the form of a man page-like website.

sued as a library's documentation is present on docs.rs, in the standard Rust documentation format.

You can also just read the source code yourself.

Features

Accelerated

sued is written in pure, idiomatic Rust.

Its speed, as a compiled line editor, is pretty damn fast. The time between opening it up and getting some text edited is negligently small.

You can even run a compiler or an interpreter with a simple ~runhere, without even the need to save your file.

And it doesn't even take a second. As it should be.

Uncomplicated

sued is much more user-friendly than ed - it's a modeless editor, so there's no complicated mode switching to keep in your head. You're always in insert mode.

It also uses a simple command syntax, with whole words, like ~save, ~show and ~open, not single letters.

Its error messages, despite being communicated concisely, are still informative and use colloquial language, so they're pretty easy to understand.

Efficient

sued looks basic on the offset, but under the hood, it has support for regex replacements, file searching, pretty-looking line numbers, and some other stuff.

sued's command set consists of stuff like delete, indent, insert, open, run, runhere, save, search, show, substitute, swap, and so on.

For the rest of the commands, as well as information on what these commands do, run ~help inside sued or check out the documentation.

And sued leverages linefeed for its command line input. Meaning it supports GNU Readline commands and functionality. You can do some Emacs-style line navigation, like C-a, C-e, C-f, C-b, whatever you want, it'll work. Probably.

Integrated

Most text editors will boast stuff like VCS, LSP, debug tool, compiler, interpreter, linter and built-in terminal integration.

sued, however, is not one of those.

Instead of integrating stuff into its code, sued provides the ~run and ~runhere commands to run a shell command as if you ran it in your terminal, without ever having to leave sued, and when the command is done, you're immediately back to editing.

And ~runhere is special - it will have sued create a temporary file and run the chosen command with that temporary file as an argument, and then when that external program is done operating on the temporary file, it's read and synchronised with the original buffer contents.

Writing a Python script? ~runhere python. Want to check your Markdown file is up to scratch? ~runhere markdownlint. Need to hop to a more powerful editor whenever you need that power? ~runhere vim. It's that simple.

Oh, and you want to talk about integration? As of version 0.18.0, sued can be integrated as a Rust library with your favourite Rust programs, so you can run sued's line editing commands in your own software, even if that software uses a completely different user interface! Check out the sued as a library README for more details.

No-nonsense

sued is designed to not get in your way. Error messages are useful but brief.

They're not ed levels of brief, but they're still pretty brief.

And there's no auto-save feature - your file is only saved when you enter the ~save command.

Ubiquitous

Being a CLI app, you can run sued anywhere!

In your terminal, in VS Code, in Emacs, even inside Vim! And sued doesn't care what OS it runs under. Windows, macOS, GNU/Linux, BusyBox/Linux, other kinds of Linux, BSD, ChromeOS, Android, probably Xbox if you really wanted.

If it has a terminal, it can run sued.

(I'll probably be able to run it on anywhere C can run once I write FFI bindings for sued as a library.)

It's been tested on Windows, Fedora and Android, and works great under all three.

Licence

sued is free. By that I mean libre. By that I mean open source. Actually that's a contentious topic, but the fact remains that sued is free.

sued (including sued as a library) is distributed under the Apache License, Version 2.0.

This licence was chosen so that sued as a library can integrate with any software, proprietary or otherwise, even if that software uses a different licence.

The Apache License 2.0 means you can do whatever you want with sued, including:

  • using sued as a text editor for any purpose
  • using sued as a library in any software, for any purpose
  • distributing sued, either as an editor or a library, in any software, for any purpose

However, you must accept:

  • sued is distributed to you on an "as-is" basis
  • I can't be held liable for anything going wrong, whether it's a fault within, arising from, or completely outside the software
  • you do not receive trademark rights, so you cannot use the name "sued" in your own projects without my explicit permission

If distributing a modified version, you additionally must:

  • credit me (Arsalan "Aeri" Kazmi/AeriaVelocity) as the original author
  • state any changes made to sued's source code
  • retain the Apache License 2.0 document in your version
  • keep the copyright, patents and trademarks of the original version of sued

Linking sued as a library (statically through Cargo or otherwise, or dynamically linking a shared library version) does not count as modification unless the library itself is modified.

This is a brief summarisation of the licence document and may not hold up in a proper legal context. See LICENSE.txt for the full document.

Naming

The name of the project is sued, in lowercase (i.e. not "Sued"), and the

proper pronunciation is /suːɛd/ (su like "sue", ed like

"bed")

Please only call the project "sued" if you're referring to the complete package - comprised of sued's text editing components and sued as a library.

If you're strictly referring to sued's text editing components (such as the REPL and everything as part of main.rs but not lib.rs or any other module), please explicitly refer to it as "sued's text editing components". The name "sued" on its own should be reserved for the complete package.

If you're only using sued as a library (i.e. sued is in your Cargo dependencies or you're dynamically linking a shared library you compiled yourself), please call it "sued as a library" or "suedlib" instead.

For example, you might say:

Foobar is a text editing utility built on sued as a library.

or

Foobar is built using suedlib.

If you make a project based on sued as a library (i.e. an editor frontend or your own custom editing commands), you're free to use the "sued" name in that project.

For example, a reimplementation of Vim using sued as a library might be called "visued".

Dependencies

~4–15MB
~196K SLoC