HomePage | RecentChanges | EditorIndex | TextEditorFamilies | Preferences

A full screen editor with a bytestream view of the world, a regular expression based core and a command line.

 Author:    Rob Pike
 Homepage: (unofficial)
 Download:  Unix: (as part of plan9port)
            Unix: (standalone, but somewhat old?)
            Unix: (standalone, updated version of the above with scalable fonts and better keyboard support)
            Windows: (Sam plus utilities)
            Windows: (Windows installer) 
 Documents: (overview)
   (command language)
   Sam man page       
    The text editor sam
   Sam quick reference card
 Family:    BellLabsFamily
 Platform:  Plan 9 from Bell Labs
 License:   Open source

The primary text editor on the Plan9FromBellLabs operating system.

In the words of Eric S. Raymond:

Sam is a fairly straightforward descendant of ed, remaining much closer to its parent than vi. Sam incorporates only two new concepts: a curses-style text display and text selection with the mouse. [...] Because the mouse is available to do selections and rapidly change focus between buffers (including the command buffer), Sam needs no equivalent of the default (command) mode of vi. The hundreds of extended vi commands are unnecessary and, therefore, omitted. Overall, Sam adds only about a dozen commands to the seventeen or so in the ed set, for a total of about thirty. [1]

In addition, the internals to Sam are quite interesting too since it is implemented as a two part editor. Of course, the concept of Plumbing? is pretty unique to Plan9FromBellLabs.

There is a version for Windows that allows you to get a feel for this innovative TextEditor.

There was an interview October 18th, 2004 on with Rob Pike (author of sam) who was asked:

Emacs or Vi? - by Neil Blender



When I was a lad, I hacked up the 6th Edition ed with Tom Duff, Hugh Redelmeier, and David Tilbrook to resuscitate qed, the editor Ken Thompson wrote for CTSS that was the inspiration for the much slimmer ed. (Children must learn these things for themselves.) Dennis Ritchie has a nice history of qed at

I liked qed for one key reason: it was really good at editing a number of files simultaneously. Ed only handled one file at a time.

Ed and qed were command-driven line editors designed for printing terminals, not full-screen displays. After I got to Bell Labs, I tried out VI but it could only handle one file at a time, which I found too limiting. Then I tried emacs, which handled multiple files but much more clumsily than qed. But the thing that bothered me most about vi and emacs was that they gave you a two-dimensional display of your file but you had only a one-dimensional input device to talk to them. It was like giving directions with a map on the table, but being forced to say "up a little, right, no back down, right there, yes turn there that's the spot" instead of just putting your finger on the map.

(Today, emacs and vi support the mouse, but back in 1980 the versions I had access to had no support for mice. For that matter, there weren't really many mice yet.)

So as soon as the Blit started to work, it was time to write an editor that used the mouse as an input device. I used qed (mostly) and emacs (a little) to write the first draft of jim, a full-screen editor that showed you text you could point to with a mouse. Jim handled multiple files very smoothly, and was really easy to use, but it was not terribly powerful. (Similar editors had been at Xerox PARC and other research labs but, well, children must learn these things for themselves.)

A few years later I took the basic input idea of jim and put a new ed-like command language underneath it and called it sam, a locally popular editor that still has its adherents today. To me, the proof of sam's success was that it was the first full screen editor Ken Thompson liked. (He's still using it.) Here's the SP&E paper about sam from 1987:

A few years later, I decided the pop-up menu model for commanding an editor with a mouse was too restrictive, so I started over and built the much more radical ACME, which I'm using to write these answers. Here's the ACME paper:

I don't expect any Slashdot readers to switch editors after reading these papers (although the code is available for most major platforms), but I think it's worth reading about them to see that there are ways of editing - and working - that span a much larger gamut than is captured by the question, 'Emacs or VI?'

(Links enabled and Wikified by RonPerrella but text undisturbed. Capitalization changed to suit Wiki.)

HomePage | RecentChanges | EditorIndex | TextEditorFamilies | Preferences
Edit text of this page | View other revisions
Last edited October 7, 2016 10:11 pm (diff)