is "vi" worth learning in 2022?

You can compare vi with driving car with manual transmissions. Many people, special in US don't know how to drive with manual but they are driving. Is driving with manual must to learn?
I am using vi because I learned it on AIX on RISC computer which we had at work but now after all this years there are other editors and young users too which have wright to decided what editor is for them.
 
vi(1) is one of the hardlink to ex(1).
As you can see in the manpage, ex and vi are different interfaces to the same program. It checks fo argv[0] and switches its behaviour by what name it was invoked. So I consider vi part of ex as a kind of wrapper. This is why I said vi as modal.
And maybe by the very limited hardware resources when vi/ex was developed, screen editing feature is, I think, incomplete.
Yes, it is surely mighty "line editor". But see later screen editors. Most of them except delivetives of vi can input/edit directly without typing "i" first.
 
Editors are either bi-modal or not. It's a design choice. With bi-modal editors keystrokes have different meanings in different modes. editors/emacs, for instance, is uni-modal, so any given keystroke always almost always has the same meaning. But, there's a lot of keystrokes to learn. It's a misnomer to think that uni-modal screen editors are better because they are uni-modal. Different, yes.

The above is unrelated to the additional line editing mode that you associate with ex(1).

ex(1) provides the line editing functions of original ed(1). It was designed into vi(1) because sometimes the command line editing is profoundly more powerful, especially where global changes and regular expressions are involved. And the reason that AT&T got ownership of vi(1) is because the AT&T lawyers managed to convince somebody that Bill Joy used code from ed(1) when implementing ex(1) functions in vi(1). Consequently, Keith Bostic re-implemented vi(1) from scratch (and called it nvi(1)) so FreeBSD (and the other BSD variants) would get back the use of Unix's favourite screen editor.
 
Last edited:
So I consider vi part of ex as a kind of wrapper.
“I remember en but I don't know how it got to ex. So I had a terminal at home and a 300 baud modem so the cursor could move around and I just stayed up all night for a few months and wrote vi.” -- Bill Joy.

Pretty much any one can learn enough vi in a few minutes to use it well enough.

editors/emacs, for instance, is uni-modal, so any given keystroke always has the same meaning.
Not really. Once you type ^x, the following keystrokes have a very different meaning! vi can be easily changed so that (with an option) it starts out in insert mode. May be add another option so that it shows 2-4 critical commands in the bottom line (which can be clicked on if the mouse works).
 
Unfortunately, if I recall correctly, maybe on sysinstall, I've required to edit something BEFORE I CAN man vi. Also, at the moment, I didn't know vty switch with Alt-Fn to read man vi. It was too late to set EDITOR environ variable to change default to ee (at the moment, I didn't know that FreeBSD has ee). There was no warnings that anyone trying to install FreeBSD must know basic usages of vi. I learned about vi, vty swtich and existence of ee AFTER installed FreeBSD.
Fortunately, there is this: Learning the Vi Editor, a highly recommendable book. Unfortunately, noone ever reads books nowadays …
 
https://www.oreilly.com/library/view/learning-the-vi/9781492078791/ is a newer book covering both vi and vim. I haven't read them but have seen other documentation mention that there are some slight differences between our nvi and some other vi versions. I should still get a vi book someday. It is a shame that it is as difficult as it is for new people to learn vi from FreeBSD's official documentation that guides new users such as the handbook.
As for the 'edit without pressing I or other similar keys', I would agree if not still plagued by some keys being misinterpreted by editors, terminals, etc. I'm not good at it but at least all navigation works in vi if learning the alphanumeric navigation instead of arrowkeys, pgdn, etc. and its very rare that I want to start typing at the start of a file. hjkl navigators often feel slow with wbe, and better, ft/ navigation gets added in.
 
One other thing worth mentioning is that many other programs, e.g., mutt and neomutt, use the vi keystrokes to navigate--probably because the original creators of such programs were used to vi. For example, seeing a list of emails in mutt, one can go down the list with j. Not that anyone cares too much, but in fluxbox or openbox, I use the vi navigation keys to move windows around the terminal because I'm used to those keystrokes. The dwm window manager does the same. To move between windows, they use jk, to expand a window they use h and l, and so on. So, if you're not a Gnome or other big desktop environment fan, knowing vi will help with other programs.
 
My own personal bias is to reward those that read documentation. They are the kind of new user I would try to attract.
Tough project. Reading competence degraded lately in the "Western hemisphere". New users get attracted more likely with MEMEs. Although not a few try hard listening to podcasts before falling asleep. But reading ... else than the shopping list?
 
My bias is to make things very easy for newbies (such as a bike with training wheels) but incentivize them to learn more professional tools (a racing bike). No one should be forced to wade through pages of boring text just to learn how to use a tool. Yes, you should have a precise and clear reference manual but that is for the professional who pays attention to detail and wants everything just so. This is why I'd rather make vi easier to use by newbies than a separate "easy" editor such as ee. With ee, given its inconsistent and limited command set, they'll always use trainings wheels. With vi, soon they learn that to delete 3 words or lines, it is much faster to type 3dw or 3dd than a whole bunch of x; and learn about regular expressions and how to make global changes etc.
 
A pretty long discussion it has proved to be, hasn't it? ;);)
Well, I like vi because yes, it's been there from the start. So there's that to it -- it's history. But it's also VERY useful, not only because it's in every Unix(like) OS out there. Yes, it seemed strange at the beginning... in that it just wasn't like any GUI based editors I was then familiar with. But then, those other things you said you considered learning (instead of vi) will be stranger yet. And if so, vi is a good starting point.
Over the years though I never cease to marvel at how powerful it actually is.

Oh and... in your OP it also sounds so dramatic, as though "learning vi" was a several years long enterprise. In fact, if you have console editing job to do, you'll master it in no time, really.

.Recently, I was kinda forced to make one step further: had to get acquainted with ed(1)!! Yes, because OpenBSD installation media only includes ed, no vi, sorry. Well that's part of their thing, and I rather like it for the high quality product they offer as a result. And I had to do some editing during the installation stage... but that was fun LOL. Made me think of the time when they DID editing with programs like ed. So it also feels like some exploration of the past.

And I hate it when they needlessly replace good old programs that WORK FINE with some new junk (honestly) full of bells and whistles. But I guess that is a likely thing to hear from somebody using FVWM for his DE (me).
 
vi is already easy to use. I can't think of a simpler editor. You don't need to "wade through pages of boring text" in order to learn it either.
I remember the first time that I ever used it. I had to call my older brother to ask him how to exit the program. Very not simple if you've never used it before. I was coming from Microsoft DOS editor and was very confused. Especially given that most proprietary programs would come with a book or a print manual and I was unfamiliar with the existence of man pages at the time. Though it may be simple to use the controls are not standardized and could be considered unusual to a first time user.
 
From the man page and probably any tutorial on vi:
The commands to quit editing and exit the editor are:

:q Quit editing and leave vi (if you've modified the file, but not
saved your changes, vi will refuse to quit).

:q! Quit, discarding any modifications that you may have made.
How difficult is that to learn?

I remember the first time that I ever used it. I had to call my older brother to ask him how to exit the program. Very not simple if you've never used it before.

This occurs when one "wings it" or tries to make things work like what they know. Like Linux users trying to make FreeBSD work just like Linux. And then they complain when it doesn't.
When you want to learn something new, you have to learn it. Don't be surprised or complain when they don't work as expected based on your background and experience.
 
is a newer book covering both vi and vim.
https://cdn.stackoverflow.co/images/jo7n4k8s/production/3079ab922a7d75cd165864c52b851b48225824be-229x300.jpg?auto=format
 
Is it at the top of the man page? (Nope, I looked). You and I know how to search man pages and I bet neither of us remember when we learned that. A useful, to the beginner, man page, would have (all in my opinion, of course), right in the first few lines, press i to insert, :x to save, :q! to quit without saving.

I think, (he pontificated) that it is a matter of how much one expects. Should a user be able to install FreeBSD and immediately start using it. or should they take a training course first. (I remember doing support in the Win98 days, when every user thought it was fine to install AOL on their computer, and would then blame me when something broke--at the time, I used to say there should be a license before people were allowed on the Internet).

*I* think the answer is something like, FreeBSD is a bit harder than what you're used too, even if you've done Linux. If you want a working desktop right away with a BSD, try GhostBSD, If you want to dive into FreeBSD without training wheels, be prepared to websearch, though our forums are nicer than the ArchLinux ones.

As for vi, just tell someone to type :help, which tells ya how to get out, or to install vim and then type vimtutor at a command prompt, which has a simple tutorial.

getopt That made me laugh. Thanks.
 
vi is already easy to use. I can't think of a simpler editor. You don't need to "wade through pages of boring text" in order to learn it either.
I suspect you don't remember your initial reaction to vi. Before vi I had used wordstar (on CPM), edt (on tops 10 & may be vms), Wylbur(?) on VM/CMS (ibm), teco (on ITS & tops), Rand Editor (on Unix). Of these, all 2D display editors were easier to use than vi. They directly put the editor in insert mode.

You may/ma not recall that this was most people's introduction to vi back in late 70s/early 80s ==> https://www.ele.uri.edu/faculty/vetter/Other-stuff/vi/vi-intro.pdf -- back then we actually read user's guides and manuals. But this is indeed 28 pages of boring text (in 2023). Who reads manuals these days? But no, this paper is not user friendly enough so there is this "Learning the vi editor" Oreilly book. Now you have 327 pages of boring text (ok, I grant that the blank pages are not boring), But no, we need one book for both vi and vim. So now you have 545 pages of boring text. But even if you read all this, you won't be able to *master* these editors. For that you have to use them day in/day out.
 
The paper An Introduction to Display Editing with Vi by Bill Joy and Mark Horton was distributed with the 4.x BSD release documents in both hard and electronic copy.

It's available as a PDF, and HTML in the FreeBSD document archive.

It's 27 pages. I got a hard copy and sat down in front of a vt131 for half a day in 1983. You don't need to read hundreds of pages!

Edit: my point is that is took half a day, but that's all it took. If you want to work with Unix there is an entry cost, and unless you pay it, you will be frustrated. It has been ever thus.
 
A bit late to this thread, and have not gone through all of the pages of posts, but been using Vim for a while and enjoy it, and still learn new things! I recently discovered YouTuber, "ThePrimeagen", and he has an entertaining intro to Vim, as well as other entertaining content.

Vim As Your Editor - Introduction

Then there is this guy... He will show you absolutely ridiculous things you can do with Vim. Maybe a few people around here have heard of him? haha
Damian Conway, "More Instantly Better Vim" - OSCON 2013

Anyway, Vim is amazing... and so is FreeBSD. :cool:
 
I'd say, without criticizing any point of view, that dbuckhal's post sort of shows the difference between young and old. Younger folks tend to like videos, like the ones linked. Older folks get annoyed at something, that could be read in 5 minutes, taking a 38 minute video. I'm generalizing of course. But we old folks remember what we thought of as the good old days. No doubt our parents did too, and thought we had it easier in school than they did.

Anyway, I get too drawn into these bikeshed discussions because my wife is away and I have too much free time. I don't think vi is intuitive, but seriously, way back in this thread I mentioned how my boss had to do something because I didn't know vi and I went home that night, did a web search, found a tutorial and quickly learned the basics. So, I would say, even if it isn't intuitive, learning the basics is fairly easy. Getting good at the basics takes longer--but by then, you've probably used it enough so that it seems intuitive.
 
Back
Top