r/ProgrammerHumor • • Apr 20 '15

vim

Post image
1.3k Upvotes

427 comments sorted by

View all comments

70

u/iLostMyAcc Apr 20 '15

I really don't know why people use vim. Can anyone explain it to me?

294

u/why-the Apr 20 '15 edited Apr 20 '15

Summer of 1997.

We had this little Slackware Linux server running as a router/firewall/email server in a closet, in another building, next to a bunch of wiring for this little internet cafe I worked at.

We found out our 'sysadmin' was running a pirate FTP site off of it. They fired him and told me -- since they had seen me using IRC remotely on a shell and assumed that meant I 'knew unix' -- to take over administration of this machine. I was young, naive and thought it would be fun.

A few weeks later I screw up trying to remotely recompile and install an updated kernel (back when this was difficult), and suddenly it stops responding.

So, in the height of summer, I'm stuck in a hot, dark, tiny closet for hours, sitting on the floor cross-legged trying to figure out how exactly I'm going to get this working again.

...and the only editor that you could use was vi, which I had never used before.

It was in that moment that I decided I was going to learn that awful, twisted evil little program because there was no way I was going to be defeated by a text editor. After that I made sure I used vi any time I needed to edit any text file, just so I would know how to use it if the situation ever came up again.

So I use it out of fear, really.

46

u/[deleted] Apr 20 '15

A charming love story

41

u/sfall Apr 20 '15

So you were tortured into using it makes sense

28

u/hungry4pie Apr 20 '15

stockholm syndrome

6

u/Neekoy Apr 20 '15 edited Sep 08 '26

Dinosaurs grey nonmetal dolls versed nose rain close

This post was anonymized with Redact

→ More replies (1)

86

u/noop__ Apr 20 '15

Because it let's me modify text faster, and more precisely than any other text editor in existence. And the portability (console based, *nix) makes it so I can have the same text editing workflow on all of my machines including the several thousand headless servers I manage.

28

u/iLostMyAcc Apr 20 '15

" it let's me modify text faster, and more precisely than any other text editor in existence." Do you have a example?

18

u/dysmas Apr 20 '15

It's not just being "faster" though, which lets be honest - is debatable.

The main thing that sticks me to vim is how it makes editing text effortless,

When I want to modify a given piece of text, the vim commands map very closely to my mental wishes, the changes just flow out.

10

u/nupanick Apr 20 '15

This is the right answer imho. It's not that vim somehow magically speeds up your workflow; I find for most tasks it takes about as long as a traditional editor still. It's just that vim's shortcuts are designed specifically to work the way you think when you work with text documents a lot. I've already internalized the shortcut for quickly cutting and pasting a single line, for instance, because I do that a lot when I'm making lists. And on top of this, it's console-based, which is a big plus over any graphical editor because it means I can use it on any machine.

26

u/noop__ Apr 20 '15

The vast array of movement and editing commands, and the modal interface with which they're presented allows almost anything to be just a couple of keystrokes away rather than being hidden away in the menus of gui text editors. Yeah, there's a steep learning curve to vim, but once you get the hang of it, you'll feel completely crippled in anything else (of course, until you get really good with $othereditor, but then you can make this decision for yourself, and I'll bet $10 you'll choose vim).

11

u/Dooey Apr 21 '15

Gui editors: Features are hidden away in menus Vim: Feature are hidden away in man pages.

I'm not sure which is better.

→ More replies (7)

10

u/mallardtheduck Apr 20 '15

just a couple of keystrokes away rather than being hidden away in the menus of gui text editors

Except that every GUI ever binds the menus to simple keystrokes. That way, "power users" can do things fast, while new users still have a chance to learn.

51

u/larhorse Apr 20 '15

so no on the example?

I mean, don't get me wrong, I absolutely understand the point about having an editor that I can use on a headless server pretty much anywhere, and I put up with vim during day to day use because of that. (cause really, VIM is better than nano at least)

That said, I vastly prefer pretty much anything else for actual coding. Sublime, Atom, TextMate, hell even Notepad++ if I happen to be stuck on windows (although NEVER notepad).

I even caved two years or so ago, and spent 6 months using nothing but vim to see if it changed my feelings about it. I really wanted to feel like I was being more productive, but in all measures, I wasn't. Turns out the mouse is REALLY damn good at doing things like selectively targeting text and precisely moving selections. It's almost like it was designed for that task. Plus it means I don't have to keep hundreds of esoteric key commands in my head!

0

u/[deleted] Apr 20 '15

[deleted]

→ More replies (2)

18

u/noop__ Apr 20 '15 edited Apr 20 '15

90% of my editing (4-12 hrs/day depending on the day), is done through an ssh session, so gui editing isn't really even a valid comparison. But that's just my use case. Obviously if another tool works better for you, you should use it.

and spent 6 months using nothing but vim to see if it changed my feelings about it

That is not nearly enough time to learn vim. I learn new stuff about it (and it makes me better) every week, and I've been using vim as my exclusive editor (aside from when I'm giving new stuff a shot) for the last decade.

→ More replies (16)
→ More replies (5)

9

u/j201 Apr 20 '15

If you search 'vim screencasts', you'll find a bunch. This is a cool one: http://blog.extracheese.org/2010/11/screencast-custom-vim-refactorings.html

→ More replies (2)
→ More replies (8)
→ More replies (42)

42

u/jpco Apr 20 '15

Do you mean like, as opposed to emacs, or why anyone uses a textual editor at all?

Or are you being facetious... I can't tell..

→ More replies (1)

8

u/[deleted] Apr 20 '15

So this question of yours is here to prove the bottom part of the image, look at all the answers! You won't get mine, I'll go to vim to save those several productivity seconds for today :)

10

u/3pieceSuit Apr 20 '15 edited Apr 20 '15

Reasone # 1: Modular Keybinds

e.g. d is the prefix for all delete commands, y for all cut (yank) commands. So dw deletes to the end of a word, while yw cuts to the end of a word. dd deletes a line, naturally yy yanks an entire line

This is fairly natural and intuitive once you get accustomed to using plain keys as shortcuts (instead always coupled with a modifier)

Reason # 2: Discrete Modes

Insert Mode, Visual Mode, etc. These modes mean that keybinds can be far simpler, often only 1 or 2 characters as opposed to the arcane combinations of modifier keys and letter keys that emacs/nano/ etc demand.

8

u/Sean1708 Apr 20 '15

Reason # 3: There are literally no other modal editors that feel even half as natural as vim.

4

u/phail3d Apr 20 '15

This article really cleared up a lot of things for me: http://www.viemu.com/a-why-vi-vim.html

I had personally been using vim in high school and university for quite a while, but without really knowing how to use it (being always in insert mode, using arrow keys and so on). This is not really productive, and my time would have been better served with using another editor.

However, when I started on my first job, I deliberately took the first month or so to really learn vim, and it has been one of the best investments of my time. It makes common text editing chores such a breeze, and all the key bindings get stuck in your muscle memory so they come automatically any way! The flipside, of course, is that I sometimes have hard time using other editors (and Word) without vim key bindings... :wq

The article I linked to really outlines the best parts of vim, IMO. This article by Bram Moolenaar is also rather good.

4

u/Cley_Faye Apr 20 '15

Because it's a text editor and it is good at editing text and other text-based stuff?

→ More replies (22)