1. 27

  2. 10

    My main editor is acme(1), sometimes I fire up sam(1) when I either do batch edits, or when I need to do more than quick edits on remote computers. However, for general system administration of remote computers, I use ed(1), the standard editor. Its main feature compared to vi(1) is that it doesn’t take over the screen, so I don’t lose context of all the history. I find that valuable.

    While I don’t think anybody should switch to ed(1), I think that knowing how to use it is essential, and the value of not losing context while editing text should be more appreciated.

    1. 4

      Wow, I’ve never seen anyone actually using acme outside of the plan9 team and maybe the cat-v crowd. What do you use it for? Why do you use it?

      I have it installed via the plan9ports on my laptop, and sometimes play with it, but since I’m so used to either vi (specifically nvi or vis) or emacs keybindings, I can’t really be productive in it. And I can’t even start using sam, although I do have experience with writing scripts with ed, and have used it over slow ssh connections.In fact I belive that it might have been exactly the linked article that pushed me to bother learning anything about ed. Would you know of any resources like that for acme or sam?

      1. 10

        I use acme for everything that involves text files, source code or otherwise. It’s the single most important program that I use. If acme were to somehow disappear from the face of the Earth tomorrow, I would re-write it. All my friends who use acme say that they would do the same. Fortunately, because acme is so small and so simple, that wouldn’t take very long.

        I use it because it’s by far the best text editor. As for why it is the best text editor, that is rather difficult to explain. I could enumerate a list of features, but realistically that wouldn’t be very enlightening. It’s not any single feature, it’s the whole package, and you have to experience it.

        The most important things to me though are the mouse-based interface, the fact that text is executable, and the fact that it doesn’t have any configuration options. I suggest watching the linked Russ Cox video, it does a good job demoing acme.

        As for sam, I don’t know of any other resource rather than the sam paper. I don’t like the sam user interface, I’d much rather use acme, but some people disagree about that and prefer sam. However, sam has some features that acme lacks. The way the program is split into multiple processes means it works extremely well for editing remote files. Even better than ed. The user interface always runs on the local terminal, while the server side does the actual edits. The protocol is extremely efficient, not just in throughput, but in latency too. Editing files over satellite connections with seconds-long pings is doable.

        However, what sam really excels at is editing multiple files at once. I routinely edit thousands of files at once in sam, e.g. when doing large scale refactoring. I know of no better tool for that than sam.

        1. 1

          What OS(s) do you use acme and Sam on?

          1. 2

            I use sam on everything that I use, macOS, Solaris, Linux, FreeBSD, OpenBSD and Plan 9.

            I use acme on my workstation systems, macOS and Plan 9. Exceedingly rarely I get to use a Linux desktop system. Then I use acme there too.

            1. 2

              Sounds like you use Sam like I use vi keybinds: Everywhere it can possibly fit.

              I think that for me, the lack of syntax highlighting is probably one thing that will keep me from using Sam/Acme for the indefinite future, as fascinating as they are.

              1. 3

                syntax highlighting

                Try dropping it for a while. You might not miss it as much as you’d think!

                I personally thought I’d never live without it, but nowadays the only time I notice its absence is when I forget to close a string literal. Otherwise, I’m far happier without it.

                1. 3

                  I’ve dropped it on and off when I was experimenting with using greyscale on my screens. But there are places (like HTML templates with Angular), that really suffer if you don’t have syntax highlighting, at least they did for me.

                  1. 3

                    Greyscale screens!? Trip report needed!

                      1. 1

                        Basically using color space simulation to get a monochromatic screens. It doesn’t get rid of syntax highlighting entirely, but reduces it by a lot, and can be pleasant when code is well structured. HTML templates aren’t given to being structured well

        2. 3

          Have you checked out vis? It is a bare-bones vim w/ sam commands. Plus it be used as an interactive filter when piping commands.

          1. 3

            I know about vis, but I never had any interest in trying it out. In general, I stay away from curses programs if I can help it, and I also avoid installing software if I can help it, even though it might be useful. I’d rather use a real GUI program, or some command line program (non-curses). Preferably something that already comes with the system (acme fails the last requirement, sadly on some Linux distributions ed fails too). I use irssi regularly and it bothers me greatly that that is the state of the art.

            1. 1

              I use irssi regularly and it bothers me greatly that that is the state of the art.

              irssi was state of the art in…. 1999? It’s certainly not in a world where WeeChat exists, let alone protocols that claim to obsolete IRC.

              1. 2

                I looked at weechat, and it was a curses program, exactly like irssi. To me, there’s no real difference. Except that it also had a web frontend, which made it worse (!). Plus weechat, in its default configuration used more screen estate than irssi, which to me again made it worse. But thanks for the suggestion, I am very interested in alternative IRC clients.

                Other protocols have no value to me because of network effects.

                1. 1

                  If you’re some kind of purist, ii works.

                  1. 1

                    Yeah, I need to try out ii and ircII.

                    1. 1

                      Isn’t there an IRC client (or however one would want to call it) for Acme?

                      1. 1

                        There is, but in my opinion it is not very good, and I don’t really like programs that use acme as their interface. I prefer to use acme for editing text only.

                        1. 1

                          IIRC (lol), ii exposes all kinds of magic files for interacting with channels. I think that’d integrate nicely with Acme by default

                2. 1

                  Something I do fairly often is SSH to a remote server to take a look at its logs. I could cat(1) the log file to read it, but if it is long (most are) then it will wipe out my terminal’s history (or at least force me to scroll back for miles) so I lose my context. less(1) is really handy for interactively taking a peek inside a log file, scrolling around, searching for the next occurrence of something I’ve found, etc. But it is a curses program. Do you ever do this sort of thing? What do you use?

                  1. 1

                    I use less (or more). It’s not ideal, but I use it.

                    1. 1

                      Damn, I was hoping you had a different solution that would work with 9term :)

              2. 2

                Which version of Sam do you use?

                1. 1

                  The one in plan9port, or the one in 9front.

                2. 1

                  That’s an interesting way to preserve history! Never thought about it.

                  Any tmux users? I usually use it, so I split horizontally to preserve history. A bit of a newschool solution ;)

                  The -4d and -2,5t. stuff is imo the most valuable take-away. I use it in vimlikes, but I would appreciate it in any other editor as well!

                3. 6

                  Somebody was bound to link to this… so it might as well be me.

                  1. 2

                    Last year, I sat down and decided to learn how to use ed. For most people, my former self included, ed is this incredibly unintuitive editor that you quit by SIGKILLing after eat flaming death! fails to work. I was pleasantly surprised to find a simple underlying model that guided the entire design of the editor: addresses and commands. After I learned different types of addresses (e.g., line numbers, line number ranges, regular expressions, etc.) and some commands, I was able to write a small Python program entirely with ed.

                    I’ve had a similar experience with awk and jq: they can look like gibberish, yet they become easy-to-use and powerful tools in your arsenal once you understand their underlying models (patterns and actions for awk, json-in/json-out filters for jq).