Pinned post
Pinned post

Why add encryption to ed? That's what crypt(1) is for.

In case you happen to find yourself editing a shell-script inside ed(1) and want to run it from within ed, you can use

!%

or if it takes arguments

!% -zf

@cks

Huge Font/Small Screen Challenge:

Open a terminal with a ridiculous font-size that results in a tiny number of columns/rows, ideally 40x25 or less, e.g.

$ xterm -fa 'xft:JetBrains Mono' -fs 42

(maximize the window)

$ echo $COLUMNS $LINES
40 10

and attempt to use your preferred $EDITOR/$VISUAL.

How readily can you edit text?

@dougmerritt I went the other direction: learned sed first and only later discovered there was an interactive version of sed (that is, ed). @ed1conf

Advanced Programming in the #UNIX Environment

Week 5: ed(1) is the standard text editor

What? You thought we could skip ed(1)? No way! It's the standard text editor. ed man! !man ed

But understanding ed(1) also helps us understand other tools like vi(1), sed(1), and ultimately even things like diff(1) and patch(1) better.

youtu.be/mRZsV7aMK0I

Show thread

Reading over @mwichary's excellent blog post about differences between Windows and Mac keyboards makes me appreciate ed(1) all the more. No need to worry whether you have Control or Alt or Windows/Logo/Mod4 or Meta or Fn modifiers or how they're named. No worries about arrow-keys or Home/End or Pgup/Pgdn or F1–F12 keys.

Just you, your text, and some 7-bit printable-ASCII commands supported by just about every computer¹

⸻

¹ okay, some like the Apple II had uppercase-only and were non-ASCII

Gonna see how far I can get using #ed to write toots sometimes.

@sirjofri
Line editors are also super handy when you're using a device that isn't so great at refreshing the whole screen, like a slow serial line
@ed1conf
Sometimes it feels like unironically using ed as an editor is something people just can't believe.

Don't get me wrong, I don't use it for huge editing tasks. It is my preferred editor for git commits and smaller things, like three-line shell scripts and changing a line in a config file and stuff like that.

#unix #ed #editor @ed1conf

So somebody created a notebook that lets you run Markdown code-blocks

If you want to run a backtick-delimited block of Markdown in ed(1) that your cursor is on:

?`?+,//-w ! command

And if it's a block of four-space-indent surrounded by empty lines, you can do similarly with

?^$?+,//-w ! sed 's/^ //' | command

(you can skip the sed invocation if the program happily ignores leading whitespace)

If you want to run one of those blocks on a remote server, you can use ssh for that:

?^$?+,//-w ! sed 's/^ //' | ssh me@remote "command"

I kind of feel like this video is my first and last comment on AI-assisted coding--or lack thereof. Namely, I coded the whole-ass Lox programming language presented in the 2nd half of Crafting Interpreters from scratch using nothing more than Rust and ed(1). Every keystroke. By myself. And I enjoyed the hell out of it.

youtube.com/watch?v=Rou26TpUG0Y

Show thread

So, I have a question for the ed(1) crowd:

Is there a way to do the following:

w !somecommand >tempfile
r tempfile

Without having to use an intermediary file to capture the output of the command?

#AskFedi #ed #ed1 #unix

Had a weird dream last night where a few friends were asking me to help them install and start using ed(1), the standard Unix line-oriented editor.

With autumn officially here in the northern hemisphere. that means it's pumpkin-spice $EDITOR season:

$ ed -p "🎃 " file.txt

A simplified history of regular expressions:

- In 1951, Stephen Kleene invented regular expressions.

- In 1966, Ken Thompson built the first software implementation of regular expressions, in the QED text editor for CTSS. UNIX ed is a cut down version of QED, popularizing the tradition of regular expressions in editors. grep started as a standalone version of the engine from ed. em, ex, vi, and vim evolved from ed.

- In 1987, Larry Wall spread regular expressions to the next generation of programmers through Perl. Gravely, it uses backtracking, spreading terrible performance for decades. It derives its engine from the rn newsreader, which derives it from Gosling Emacs. James Gosling told me he wrote it from scratch.

- In 2010, Russ Cox, having spent time at Bell Labs, rejected backtracking and built RE2, a fast and scalable engine, generalized from work on Google Code Search. Its ideas have spread to Go regexp and Rust regex, a new generation of engines. These engines dynamically select between specialized matchers, depending on the pattern.

- Since 2025, Ian Erik Varatalu has been researching regular expressions for his PhD and has produced a fast engine using symbolic derivatives. It implements seldom-included intersection and complement and efficiently implements lookaround, which had been exclusive to backtracking engines.

#unix #computerscience

Show thread

@cks Yes we also had way too many users on that poor old PDP-11/45 so no screen editors. I got really good at 'ed'. Sad since I had used EDT on a VT-100 and that editor was sweet!

I learned today that POSIX specifies a tool designed to assist you in reviewing & modifying LLM-generated code. In typical Unix fashion, they shortened "reviewing & modifying" to just two letters:

$ rm code.rs

It even has command-line options to [r]ecursively [f]ix whole directories of LLM-generated code:

$ rm -rf project/

It’s interesting that, as time passes, I grow my assortment of ed(1) scripts that optimize my workflows. Scripts that are not transferrable to e.g. #Emacs. But easy to write and integrate in The True Unix Editor.

These scripts are really useful, like an interactive narrowing grep I just wrote!

So I have perfect scripts and ed(1) versus Turing-complete Emacs and useless vi(m).

As time passes, I seem to gravitate towards ed(1).

Let’s see where that gets me.

CC @ed1conf

I got #linux 7.2 booting on my #Palm IIIxe and #Handspring #Visor! #nommu now to get my graffiti workalike working properly. (The stowaway keyboard works great for now. #ed is perfect on the 32x20 char fbcon) #busybox #buildroot. (See github.com/jsmemfault/uclinux)

Show older
BSD Network

bsd.network is a *BSD-adjacent Mastodon Instance. We have a code of conduct.