The Birth of vi
lanc writes "Bill Joy, co-founder of Sun, tells the story of how he wrote the vi editor. The article at The Register delves into his motives, who instigated the project, and some of the quirks of leaving a 'gift to mankind'. From the piece: '9600 baud is faster than you can read. 1200 baud is way slower. So the editor was optimized so that you could edit and feel productive when it was painting slower than you could think. Now that computers are so much faster than you can think, nobody understands this anymore. The people doing Emacs were sitting in labs at MIT with what were essentially fibre-channel links to the host, in contemporary terms. They were working on a PDP-10, which was a huge machine by comparison, with infinitely fast screens. So they could have funny commands with the screen shimmering and all that, and meanwhile, I'm sitting at home in sort of World War II surplus housing at Berkeley with a modem and a terminal that can just barely get the cursor off the bottom line.'"
(I'm using Emacs, BTW.)
I think in vi. When editing, commands just happen like thoughts. They are so ingrained in my brain I don't even remember the actual key sequences. When a vi newbie asks, "how do you do XYZ in vi?," I have to stop and think hard, because I don't even know the commands any more.
Vi is the ultimate editor, for one main reason. It's a modal editor, so commands can be mnemonic. With editors like emacs, you're always having to hit ^X before commands, or with MS word you're always having to lift your hand off the keyboard to move the silly mouse around. With vi, you don't need a steenking mouse. Your hands never leave the keyboard. And commands make sense and don't require that you hit some yucky control sequence to initiate.
I love my vi.
ed, baby, ed
Je ne parle pas francais.
> It was a world that is now extinct. People don't know that vi was written for a world that doesn't exist anymore
I use vi everyday but i've long stopped recommending it to most people i introduce to linux.
it really doesn't seem worth steep learning curve for most people.
Do you recommend vi to all new *nix users now?
The legacy of how vi was written is pretty much evident in the terse commands it uses - commands are short, to the point but an absolute bitch to figure out without some reference. However, the short commands are still useful in today's gigabit ethernet world with Gigahertz CPUs - the short commands are quicker to type and for plain text, I'm much faster with vi than any other text editor around.
This is good history to remember. Those who weren't there find it hard to appreciate the tremendous leap forward of Unix Version 6 and ed on a PDP-11. We had been using teco on our PDP-10 and the cousin of ed that was on Multics, but we had been getting into PDP-11s for more and more things. Comparing ed on Unix with the line editors available on PDP-11 DOS/BATCH and that new-fangeled RT-11 thing was amazing. Along with all the other tools available on Unix, the PDP-11 went from a toy to a state-of-the-art (for then) development environment. We were mostly on DECwriters and TI-Silent 700s runing hardwired 1200 baud at work and 300 baud from home over the modems. We started to get VT-100s about the time vi was being released and it was again a great leap forward.
Thanks Bill Joy! I have used your work in the BSDs and Suns and all the followons over the years, but vi was a most important gift at an important time.
modal editors is the worst idea in the history of computing. [sic]
This thinking is precisely why vi continues to be superior to other editors. For some godforsaken reason people seem to be afraid to make modal editors, so "modern" editors damn you to using a mouse or ugly awkward command sequences for everything. Can someone explain why modal editors are a bad thing? It is this very fact that's kept me using vi for decades now.
The time for dual-mode editors (where you have to press something before you can begin to type, and then press something else when you stop typing) is long since gone, thank goddess.
(ay)
Get thee glass eyes, and, like a scurvy politician, seem to see things thou dost not.--King Lear
vi was a horror when I started using UNIX systems and I couldn't understand why anyone would want to use such a strange editor. So I went with emacs and was happy. But after a while (dunno how this happened) I went back to vi(m) and invested the necessary time to learn it. I took me about a year before I could say that I'm able to use it efficiently, so the learning curve is pretty heavy. But at the end I don't regret it at all, because I feel a lot more efficient with vi(m) than with any other editor. I couldn't live without it now.
Good tools are hard to master.
I do. I love to use vi(m) for coding. And it's the only editor I can use efficiently while working remotely. And it's very configurable. And it looks s0 l33t with semi-transparent background and all those beryl effects on my Ubuntu laptop.
But seriously, vi(m) is really great once you learn it. Though I agree it has a pretty steep learning curve. Anyways, it was worth it.
Brief (by underware) is better.
I use both VI and Emacs and I just miss Brief. I thing is that the code was sold to Borland which last I looked became Impress (which isn't impressing me) and the code base is shelved. Can we OSS the code base?
I understand the issues. What I do not understand is why the HUGE advancements in VI for instance are so obscure that I use it at only a very primative level. Then we have Emacs and xEmacs.
I think we need some courses put together for kindergarten kids. The biggest issues is that most people are not willing to spend endless hours digging through unorganised and disjointed documentation. So we don't learn what our tools can do.
This is sad.
Here is what I think. I think editors have been around for 40 years at least. Some have horrible personalities. But the issue is not the personality... it is the person who loves the personality.
So perhaps we need to ask why I cannot ask Emacs to present the full "Brief" personality. I know that Emacs can do this. I've programmed a number of elisp commands. The issue then becomes.. how do we work as a community?
I am certain there are at least a billion answers. I kinda think there is a lot of code laying around that the authors of which pained over and they have "given up".
I do not know all the things VI can do. I wish I did. I wish I could rent a lecture that showed me. Numbers I got are that this costs $1000 a minuet.
Maybe this is why its not there.
Alas
I've been using them since 1993 and have never gotten used to them. I got hooked on the Borland 3.1 IDE and IMHO it was a better text editor. I appreciate the efficiency of nano and others when logged in over a serial line, but I really miss BC. One of the biggest problems has been keyboard sets. A Sun keyboard gives different scan codes than a PC and if the terminal settings don't take this into account, things get wacky. You end up with a complete evolution of keys and combinations in each editor just to cut and paste a line of text *ugh*. Nothing the same between them. Another problem with vi (and maybe others) is their growing dependancies on system libraries. I recently tried and install of vi which complained of a gtk dependancy; sheesh. This one [0] is from an embedded arm system (debian). Why do I need gpm when running vi? All I want is a simple, independant text editor that fits in a small space. The mouse isn't even useful in vi (directly). Another curious feature of these text editors is people seem to fancy themselves l33t h4x0r5 when they master the hjkl keys of vi or other un-intuitive keyboard combinations. People, you've not cracked a Gibson here; it's just a text editor. Go fix Bind, then we'll all be impressed.
[0] vim.basic: error while loading shared libraries: libgpm.so.1: cannot open shared object file: No such file or directory
boycott slashdot February 10th - 17th check out: altSlashdot.org
I use it. Vi (or better: vim) is really sweet if you have to look at textfiles of >100mb. Also, if you have to edit a file on a different machine. On the other hand, when working in a graphical environment anyway or as a suggestion to new users, I often recommend kate.
Idha khatabahum lijahiluna qalu salaman
The article has definately triggered some nostalgic moments, but it's an article from September 2003 that reports on the content of an interview conducted in 1999. It isn't really news any longer.
Yeah, ed is the best!
"When I use an editor, I don't want eight extra KILOBYTES of worthless
help screens and cursor positioning code! I just want an EDitor!!
Not a "viitor". Not a "emacsitor". Those aren't even WORDS!!!! ED!
ED! ED IS THE STANDARD!!!"
I use vi (actually, vim) all the time. Many people do. It is a *good* well featured editor which doesn't take up too much space. It runs on all the operating systems I use every day - OpenBSD, Linux, Macintosh and Windows. If I have a GUI, I use the GUI version. If I don't, I use the terminal version. It is consistent across all those four operating systems I mention regardless of whether I'm using it via the GUI or over an ssh terminal session. That consistency is worth _a lot_. It doesn't need the mouse either which makes it much faster to use. Vi is just as relevant today as it was back when it was written, possibly more so because of its consistency across systems.
Oolite: Elite-like game. For Mac, Linux and Windows
"And why do they teach the letter commands to go through the program when the up, down, left, right arrows exist on every keyboard and do the job?" They do. But they do require more movement from your hand. Believe me, once the commands for navigating thru text are impregnated in your brain, you'll crave for them even within Microsoft Word. At that point of addiction, you'll start googling "emacs key binding microsoft word"
Your ad could be here!
modal editors is the worst idea in the history of computing.
Insert mode. Overtype mode. That's modal. I suppose you're against that.
Interesting article, but this article was published on 11th September 2003.
I may be a young whippersnapper with only a couple of years of non-MS Windows experience under my belt but if there is one thing that I really felt in love in the unixy-way of doing things then that thing is vi (or vim). Sure, it has a very steep learning curve. After a lifetime of notepad-like editors, who in their right mind finds all those modes and obscure commands palatable? Yet, after a bit of teeth cringing in front of a terminal editing text then all those obscure commands start to sink in, make sense and even getting indispensable. The vi way of editing text is such a time saver that starts to be indispensable. As I see it, anyone with a reasonable vi experience is able to become much more productive at writing text than the regular way. All the operations the user will ever need are literally a couple of keypresses away. You don't need to waste time reaching for and using a mouse, resort to finger gymnastics to use modifier keys... Everything is just there at the tips of your fingers. And even if you need any custom task you can bind any custom operation to a key shortcut and you are ready to go. So many thanks Bill Joy. Your work is much appreciated. Kudos!
Slashdot, fix your code or at least hire someone who is competent at it to do it for you.
I still use vim as my primary text editor, on Linux and Windows. It's just a neat little text editor; it does everything I want it to do and it does it efficiently. Plus I've been using it for years, so I'm comoftable with it. I see no reason to stop using it.
I may have switched to using things like Eclipse for editing specific types of text file (Java, PHP, HTML and XML) and using Visual Studio for coding (because nowdays I'm primarily working on Windows), but vim is still my utility text editor when I want to quickly modify or look at a text file.
I daresay a lot of people feel the same way about emacs; frankly they're entitled to.
Yeah, I had a sig once; I got bored of it.
I haven't found vi or emacs to be hard enough.
That why I port edlin to every box I work on.
"The price good men pay for indifference to public affairs is to be ruled by evil men." ~Plato (427-347 BC)
"My PID is Inigo Montoya. You kill -9 my parent process, prepare to vi. "
modded down in three, two...
There is no sanctuary. There is no sanctuary. SHUT UP! There is no shut up. There is no shut up.
All code that doesn't fit an 80 column terminal was written by failures.
here
I see so-called "hardcore" Unix geeks advocating 'ed'. Nonsense! The ultimate Unix editor is "cat >filename". All the others are for indecisive wimps who don't know what they're going to write, or incompetent losers who make mistakes.
:w saves!
I actually want that on a t-shirt. I would do it myself, but I don't think my stenciling skills are up to the task.
nstresting comment!:wq
a toggle switch front panel with a STURDY [deposit] switch was enough for me. (God I feel O-L-D!)
PDP-8s PDP-11s, Interdata 7-32s, Cromemcoes, Keronics (Data General knock offs) all those machines I used to toggle in the IPL boot codes for every morning.
MSBPodcast.com The opinions expressed here are my own. If you don't like 'em... Think up your own stuff.
Modal editors are a bad idea, but the thing is, most people don't actually want an editor. Most of the time, they want an electronic typewriter. Entering text and editing text are two conceptually separate tasks, and this is why vi works as an exception to the rule 'modal user interfaces are bad.' Vi is really two separate applications; one for entering text, and one for editing text. Because you often want to do these in quick succession, it allows you to quickly switch between them.
I am TheRaven on Soylent News
When I was young and foolish I used notepad.
When I was forced to learn unix, I chose pico.
When I learned more about the GPL and linux I chose nano (a whole three orders of magnitude better).
When I figured out that most of the physics and astronomy I do involves coding, I tried Emacs.
When I found machines that didn't have Emacs or a network connection, I was shocked and horrified
(these are remarkably common in the astronomy world though you wish they weren't)
With no other recourse, I forced myself to learn vi(m). The vimtutor and docs were my friend.
Now I do not need them. I learned the keys. Then I forgot them. My fingers remember though...
J'y suis, j'y reste.
Reality must take precedence over public relations, for nature cannot be fooled.
Come on.. You haven't memorized "aYj"bY2j"ap2j"bp yet? (" (Store next-command in buffer) a, Yank-line. j Move to next line. " (buffer) name b Yank line. (Repeat next command) 2 times - j line-down. Then from " (buffer) name a paste. 2 lines j (down), From " (buffer) b, paste.). Once you've written that to your brain, the ability to cut and past between hundreds of megabytes of text file becomes blinding.
Or 10Gma2jd'a Goto line 10, mark line/col-number to buffer a, move down j 2 lines. d from current line to marked line a
Or 02wma2j01wd`a Go to 0'th column of current line. Jump 2 words forward. mark line/col to buffer a. Jump 2 lines j (down). Go to 0'th column. Jump 1 wword forward. delete from the `current line/col to the line col in buffer
Cryptic, but no more so than a programming language - once you learn the building blocks, complex stuff comes naturally (assuming you have a mind for compositing).
I've not see named buffering (especially with the ability to refer to either the lines as a whole or the exact col-positions) in any other editor. emacs has ring-buffers (or kill-buffers), but I've never been able to use that intuitively. There are vi key-sequences that can be applied to heavy-weight editors like emacs, eclipse or Intellij Idea, but they just don't seem to fit naturally (because the power of those editors are afforded by their special key-sequences).
The end result is that I still have gvim windows and Idea windows on separate monitors 24/7. Each type of editor does its intended role perfectly - no more, no less.
-Michael
"I edit that I edit".
[100% ISO 646 Compliant]
SVM, ERGO MONSTRO.
There _is_ a portable gVim here. And for built in vi, Firefox has the ViewSourceWith plugin, which works just great with gVim. It lets you edit any textarea using the editor of your choice. (I'm not affiliated with either of these, they're just good software.)
I remember once getting really fooled by this. I'd accidently created a file with two sequential copies of the text I thought I had. I searched for "foobar", which worked as expected; then I searched again. The screen didn't change, and the cursor didn't move. So, first I checked if the mainframe had crashed, but that wasn't it. It took many minutes of fooling around to realize what had happened: EMACS had figured out that the screen already looked right, so no need to do anything (except perhaps update a character or two on the status line). I wonder how many other people had similar experiences back in the day.
So, sure EMACS may have been too big to run fast on Bill's machine, but bandwidth to the terminal had nothing to do with it.
Long before Bill Joy, UNIX had a good full-screen editor - the RAND editor. The RAND editor dated from the early 1970s. I used it at Ford Aerospace, and it was much nicer than "vi". But it wasn't free. You had to pay RAND for each copy.
The RAND editor was much closer to "what you see is what you get" than "vi". It was a full-screen editor with all the commands on function keys. All the keys like "insert", "delete", etc. did what you'd expect. Labels were provided to show what each function key did. So it was far more user-friendly than "vi".
The RAND editor was modestly portable from terminal to terminal. It worked best on HP terminals of the period, and was table driven so that it could support different devices. But you had to change the tables in C and rebuild to add support for a new device.
The RAND editor had fewer "mode" issues than "vi". What you typed went in at the cursor position. For a few special commands, like "find", a special line at the bottom of the screen was used. But you could always see visually what was going on. Much better look and feel than "vi".
Those of us who had both available used the RAND editor.
Some of what Joy is credited for in the early days of UNIX reflects the fact that he worked for a tax-funded organization working under a contract that allowed them to give software away.
Up until recently I worked at Borland. My whole team was informed by teleconference that our work was offshored. Anyway, I used Brief in the 90s at other jobs, both before and after Borland bought it. So naturally, I assumed it would be easy to get a copy of Brief to do my development, given that my employer owns the program. Sorry, the help desk doesn't know anything about Brief and can't help you. So, I stared googling for a bootleg copy, from my Borland workstation, of Borland software.
Any wonder Borland is about to go bankrupt?
Naw, man, sed is way better than ed!
Real geeks use an editor that doesn't display anything at all. And with sed, I can screw up all the files in a directory at once, instead of one at a time with ed.
That's all I have to say, but I think it had to be sed.
(T>t && O(n)--) == sqrt(666)
You make the point well enough about all the security. That means it's a lot saner to run your web configuration through Apache or something. It also means you'll have to deal with issues like a username/password, and you'll probably want to proxy the whole thing through SSH or something (or you'll need an SSL-enabled Apache)...
Unless you're doing something AJAX-y, changes do require you to fill out a form and hit "submit", and wait for a response. I don't really see how this is different than editing a config file and pinging the app. But if you're going to do something AJAX-y, we're getting pretty heavy into the realm of external dependencies -- this is no longer something you want embedded into your app, the way CUPS configuration is.
And I don't really want to have to install Apache, mod_ssl, and some AJAX libs just to configure, say, an IRC server, or a DNS server.
Besides: It doesn't have to require pinging the app. I seem to remember exim checking the timestamp on its config file with every mail received, so if you made a change, you could expect it to take effect instantly. Another way to do this would be inotify -- I believe vim writes all your changes to a temporary file, then 'rename's the temporary file on top of the original one. Thus, as soon as you see a new file there, you can probably parse it -- worst case, if you don't trust the text editor, you can wait a second or two for the inotify events to settle.
Now, there are advantages -- you can actually display a finite set of options, you can show the user what their system can actually handle, and there aren't going to be any syntax errors. But none of these have ever really been a problem for me -- I can crack open just about any config file, read the comments, and make a few changes, and be confident that it'll work.
Don't thank God, thank a doctor!
I don't like :x. To my mind the words e(x)it and (q)uit are synonymous, whereas "(w)rite then (q)uit please" or "(w)rite then (q)uit DAMN YOU(!)" are obviously not the same as just "(q)uit please". I clobbler fewer files this way.
One can edit in VI very efficiently without moving the keys from the home position, and doing unnatural stretches for odd keys.
Love many, trust a few, do harm to none.
### Insert mode. Overtype mode. That's modal. I suppose you're against that.
Actually it is bad, so bad that Microsoft and a bunch of other keyboard manufactures moved the 'Insert' key which switches between those modes and made it only available via weird Fn-Key combinations. For a lot of people it causes a lot more trouble then worth it and truth to be told, for writing text I have never actually used the mode myself, the only reason when I use it is if I program and have to change some stuff where overwriting is faster then hitting delete or using regex (say multiple lines below each other where a '+' has to be changed to a '-' in only a single column).
alias nano="nano -w" is found in most of my .bashrc files. You can also add set nowrap to /etc/nanorc or ~/.nanorc. I just noticed that option today.
End of Line.
I've trolled about vi myself a couple of times in the past, but installing FreeBSD a few weeks ago finally convinced me to take the time to pick up at least a very rudimentary degree of mobility in it.
If nothing else, the one thing which it gave me which I'm actually grateful for is that it disrupted my old habits/patterns (if only temporarily) and forced me to have to think. Vi is a thoroughly alien interface compared to virtually anything else I've used, and although with the tutorial (which is surprisingly good) it's discoverable, I don't feel it would have been without it.
I'm still undecided as to whether or not I feel the interface has actual technical merit, or whether it's simply something vestigial that certain people are so fond of for whatever reason that they've been unable to force themselves to throw it away...although if it's true as Mr Joy says that the editor was originally designed for, and works in, extremely low-bandwidth environments, then that element at least is something which I feel is very much worth keeping.
One thing which I find extremely distressing these days is that many people seem to feel that the conservatism which motivated the philosophy behind a lot of early UNIX software is an anachronistic attitude and is no longer warranted, given the glut of cpu cycles and other system resources we now find ourselves in. I would urge such people to remember that even under normal circumstances, in some situations (such as embedded/small devices) such is not always the case, and that not only that, were a sufficiently large scale disaster of some kind to happen, it could universally cease to be the case also.
Conservatism is a good thing to hold onto. Certainly, when the sun is shining and everything is fine, you can feel lulled into believing that not only do you not need it, but that you'll never need it again. If the last few years have been any indication however, some parts of the world are going to continue to face severe environmental catastrophes going forward...and the conservatism of old school UNIX may be one of the only things we know about that could keep computer infrastructure going in such places under such conditions. It is very strange how the past can often end up being the present and the future, especially when we do not expect it.