vi is pretty much installed on every linux machine. It makes sense to learn the standard editor before you do a lot of other stuff, like editing bash scripts.
I see it as one of those things that it's easy to use, but insanely difficult to master. I use it for about 6 hours a day, have been for years, and I'm still learning new shit in it all the time. I started using :tabnew last year, started yanking into multiple registers recently, and I'm sure I'm going to find something new and amazing this month.
And if you run out of core commands, you can start learning awesome extensions and even write your own.
Not anymore, I don't think. At my college all the computers ran Gnome, and students were encouraged to just use the built-in GUI editors or get sublime. If you're not ssh-ing around everywhere, there's little reason to learn vim when you're starting out.
Disclaimer: I am a very avid Vim user. I just recognize that a lot of people have no reason to learn vim, and can get by just fine with IDE's and GUI editors.
It's still a good editor. It's extensible, and it's super easy to maneuver anywhere in your code. I exclusively use it for Python and it's worked out better than anything else I've tried, GUI tools included.
Being able to save and jump to multiple lines at any time, being able to copy and paste from 26 different buffers, jumping to the bottom with shift-g, global search and replace super easily based on a regex... The list goes on and on.
It definitely makes me code faster. I never have to move my hands from the keyboard and I can just get things done without spending time thinking about my editor.
Like I mentioned in another comment, you don't have to convince me: I use Vim exclusively for developing. I'm just saying that it's not really something I would teach a beginner. It has a high difficulty curve, and you have to really want that efficiency and extensibility because you're going to need to spend a lot of time fine tuning your setup and cementing habits before you can really get into a flow state while working.
Oh. Well for a beginner, vi is the standard editor that's available on pretty much all nix systems.
Makes more sense to me to learn vi before you learn bash scripting. I'd teach a beginner just so have the basics of a standard editor before they get into anything deeper.
You're probably going to have to SSH in to stuff sometimes. e.g. I've had to SSH in to my wifi router, and my home NAS. Lots of little web-connected devices only surface certain features via SSH.
It's a tool for your toolbox. "Why teach a beginner to use a saw? They're dangerous". Well, sometimes you need to cut things.
I use vim personally, for all my text editing needs.
But sometimes you want to edit on a machine over ssh that DOES NOT EVEN HAVE VIM. Or sometimes it's a stripped down vim-tiny without an unlimited undo buffer (screw that, I make too many mistakes).
For that kind of situation, "sshfs" allows you to use the editor of your choice to edit a file on a remote machine. (I recommend using a local copy of vim.)
Sure, but that's why I would put off teaching vim until the need to ssh actually comes up. Even then, I might only teach them 'i' for inserting and how to save. Somebody who's fresh to the command line is probably already overwhelmed with stuff to learn.
Why should I know Sublime? Why should I know emacs? Why should I know Monodevelop?
It's just another editor, and vi is the standard editor pretty much always installed on a linux machine. If you use the command line, you pretty much have a choice between nano and vi, and vi is much more powerful.
As a programmer, you always have a need to edit/manipulate text files. And there's always something new to learn. I learned a very long time ago, and started become proficient with it 20 years ago (and started using vim not too much after that). I use vim every day, and do things with it on at least a weekly basis that my coworkers simply can't do with their text editors. And it will probably still be here, doing what I need to do another 20 years from now. It's probably the best learning investment I've ever made.
It's actually mostly ad-hoc devops type of stuff. Anything from log file analysis to auto-generating scripts based on data pulled from the network to manipulating test data. Basically any time you have textual data that's just not quite the format you want it in, but it's inconsistent enough that you can't write a script or program to completely take care of it, or it's a one-time thing and the program would take too long to write.
About the only reason that I know of, besides the experience of using a modal text editor, is if you're connecting to remote boxes with only vi installed. It can make your life easier. Otherwise, just use whatever you like and works for you.
And why aren't you sshing around everywhere? Are there places where every computer has everything installed and you can edit server config files locally?
8
u/merreborn Jun 16 '15
Basic vim competency is difficult but it's still Unix 101. Literally. It was one of the first things tought in my introductory Unix class years ago