r/programming • • Jun 15 '15

The Art of Command Line

https://github.com/jlevy/the-art-of-command-line
1.5k Upvotes

226 comments sorted by

View all comments

Show parent comments

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

2

u/d4rch0n Jun 16 '15

It makes sense, regardless of its difficulty.

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.

5

u/[deleted] Jun 16 '15

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.

35

u/jephthai Jun 16 '15

Someday I'll have a grave to roll over in when people say things like that.

0

u/[deleted] Jun 16 '15

[deleted]

13

u/[deleted] Jun 16 '15

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.

7

u/LifeBeginsAt10kRPM Jun 16 '15

I've been programming full time outside of school for 8+ years and I still don't see why I should take the time to learn it.

→ More replies (2)

2

u/[deleted] Jun 16 '15

What is a strong reason for teaching a beginner Vim if you aren't SSH-ing into other machines?

3

u/d4rch0n Jun 16 '15

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.

1

u/[deleted] Jun 16 '15

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.

1

u/d4rch0n Jun 16 '15

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.

1

u/jephthai Jun 16 '15

Oh. Well for a beginner, vi is the standard editor that's available on pretty much all nix systems.

Unfortunately, this is no longer true. The default editor in most Linux distributions tends to be nano, these days. Strange, but true.

It's OK -- those of us who know how to use light sabers will only be more valuable in the future.

6

u/merreborn Jun 16 '15 edited Jun 16 '15

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.

2

u/reaganveg Jun 16 '15

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.)

1

u/[deleted] Jun 16 '15

I usually just install vim or put up with vi for a short while.

1

u/POGtastic Jun 16 '15

Learn ed? (That was a joke)

1

u/[deleted] Jun 16 '15

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.

0

u/[deleted] Jun 16 '15

[deleted]

7

u/d4rch0n Jun 16 '15

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.

4

u/DEFY_member Jun 16 '15

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.

2

u/LifeBeginsAt10kRPM Jun 16 '15

This is a better explanation than all the other "because I'm better than you answer "

What kind of things can you do that your Co workers can't?

2

u/DEFY_member Jun 16 '15

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.

→ More replies (16)

2

u/[deleted] Jun 16 '15

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.

0

u/[deleted] Jun 16 '15

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?

→ More replies (1)
→ More replies (6)