r/programming • • May 23 '17

Stack Overflow: Helping One Million Developers Exit Vim

https://stackoverflow.blog/2017/05/23/stack-overflow-helping-one-million-developers-exit-vim/
9.2k Upvotes

1.1k comments sorted by

View all comments

Show parent comments

80

u/crixusin May 23 '17

You would think people realize that its probably badly designed if people are having trouble exiting your editor...

186

u/jl2352 May 23 '17 edited May 23 '17

It was designed in a time where there weren't common idioms for this type of thing. Today if you open a piece of software you expect ctrl or cmd c/x/v/a, to do the appropriate action. I don't even have to describe what they are. You know what ctrl+v does without me saying. Even many mobile operating systems support these (when they don't even have a ctrl key).

Vim predates stuff like that. You had to just invent it as you go.

Plus it's design also dates back to teletypes where some of this stuff made sense.

110

u/onmach May 23 '17

If you go ctrl+c, it actually tells you to Type :quit<Enter> to exit Vim.

50

u/evaned May 23 '17

If you're in insert mode, you have to do it twice; the first exits insert mode.

47

u/jrhoffa May 23 '17

Suicide is painless

8

u/[deleted] May 23 '17

it brings on many changes

3

u/nuvan May 24 '17

M*A*S*H

→ More replies (1)

15

u/Ciph3rzer0 May 23 '17

I didn't realize this... there's really no excuse to be stuck knowing that...

65

u/KamiKagutsuchi May 23 '17

Beginners don't know the difference between command mode and insert mode, or how to get from one to the other, or even which one they are in.

→ More replies (9)

9

u/Andy_B_Goode May 23 '17

Eh, even then it's not clear that the colon is part of the command. And if you've accidentally typed something into the document (which you probably have if you've been mashing keys trying to find the exit), you'll also need to add an exclamation mark to the end of the command to quit without saving. It pops an error message to tell you this, but the message doesn't stay up very long.

10

u/HellIsBurnin May 23 '17

the message actually stays up until you do something else, for me at least (vi too).

3

u/Andy_B_Goode May 23 '17

Oh weird, it's staying up for me now too, although I swear it was consistently disappearing without any keyboard input just a minute ago. Go figure.

→ More replies (2)
→ More replies (2)
→ More replies (1)
→ More replies (90)

61

u/mer_mer May 23 '17 edited May 23 '17

It makes sense in the context of vim, so I wouldn't recommend changing it. There's no reason to use vim unless you're willing to spend time learning how it works.

Edit: Meaning that there are a lot of easy text editors to use so there's no reason to morph vim into one of them. Vim is a power tool aimed directly at professionals who want to invest time into being more productive.

45

u/[deleted] May 23 '17 edited May 23 '17

You're being downvoted, but seriously! The way you exit vim is an artifact of the entire point of what vim is, i.e. modal editing. It's a powerful tool that is structured like that for a reason, and it objectively works well. Spending the couple of minutes it takes to internalize what an editing mode is seems like a perfectly reasonable prerequisite for using the software.

→ More replies (5)

9

u/Deto May 23 '17

Yeah - I think the problem is that it ends up being the default editor in distros so people stumble into it accidentally? Probably should have something like Nano be default instead.

→ More replies (1)
→ More replies (2)

20

u/bo1024 May 23 '17

It's not fair to expect to be able to use every program without reading any instructions.

The fault is more of Linux programs that use vi as the default editor.

→ More replies (7)

15

u/Elathrain May 23 '17

The problem isn't the design, it's the separation of modern users from 1970's design practices.

You know that ESC key on your keyboard? It was commonly used by basically everything as a GTFO button to cancel or quit things. Some modern programs retain that, but it's less common.

Second, remember that this is from an era where graphical interfaces didn't exist: everything was command line. So the natural thought of someone in vim is: how do I find the command line from inside a text editor? If you've read the manual (and you have) you know that the vim console is attached to the colon : and the natural command name for quit is q.

So the proper way to quit vim is to hit ESC a few times to make sure you exit any special editing mode you've gotten into by accident by hitting random buttons (or normal editing modes like insert mode) and then type :q and hit return to submit the command. If you want to save, you use the w command (for "write", as in "write to disk") and it looks like :wq.

3

u/anilm2 May 24 '17 edited May 24 '17

I think the problem is that mode based editing is a foreign concept to most people, and it shouldn't be the default. VI doesn't need to change - the default editor needs to change. People who like to use VI (myself included) also know how to "export EDITOR=vim". If you are too unaware to do that, you likely won't know what to do in vim.

As to design, I actually disagree about this being a "1970s" design. What other editors from that time had modal editting (i actually don't know the answer to this)? It was a design choice made in the 70s, sure, but it isn't specifically tied to the time period.

If a new modal editor were created today, it would have to work in a very similar. You would do some "thing" to enter insert mode. You will do some "other thing(s)" to exit insert mode. In insert mode anything you type will be input, aside from the "other things(s)".

You'd still be left with the 'how do I quit' problem. Unless you have mouse menus (which you get with gVim).

For example. look at a lot of KVM, RemoteDesktop, and Virtual terminals. These are modern programs that are basically modal editors. You enter "insert" mode by clicking on their GUI space. They capture your mouse and keyboard. You have to know to hit "Alt+Enter" (or something) to exit "insert" mode.

3

u/Elathrain May 24 '17

The era definitely wasn't the only influence. The time period had more to do with the abundant use of command lines and the assumption that anyone using a software is prepared to spend some time reading its documentation and/or getting used to it instead of expecting a first-time usability UX. As someone not born when VIM was made, I don't want to confuse anyone into thinking I have special insight into the details.

The "how do you quit" problem does seem to be endemic to modal editors, as you present it. I'm not familiar with those editors, but to generalize off of what's here, you need to learn the specific way that a given editor releases control or you just can't get out.

Some software like VirtualBox (not an editor but mouse/keyboard capture is a similar UI hurdle) handles this by having a semi-annoying popup that tells you how to un-capture your mouse (with a "never show this again" button). VIM "handles" it by assuming you learn how. There are arguments for both, and I'm sure there will be disagreements on their validity.

I suppose what I'm really getting at is that people saying "the design of VIM is bad" seem to be strongly implying that this means VIM is bad and should be changed (and should HAVE been changed), which I want to oppose with the idea the each editor has its place and purpose. Yes, modal editors like VIM place somewhat more onus of learning on the user, but that's a price with a payoff so you can't just generalize it as "good" or "bad".

→ More replies (2)
→ More replies (3)

20

u/JavierTheNormal May 23 '17

41 years and they haven't acknowledged it yet.

65

u/crixusin May 23 '17

"Is it me who's out of touch? No, its must be the children."

→ More replies (3)

58

u/BadGoyWithAGun May 23 '17

Not every fucking piece of software has to be easy to learn. I hate this trend of conflating easiness of picking something up with ease of use, when, more often than not, the two are inversely related.

20

u/siplux May 23 '17

Reminds me of Rich Hickey's talk, "Simple Made Easy". When most people say "easy" they mean "familiar", not "simple".

27

u/dl__ May 23 '17

No software HAS to be easy to learn but difficult to learn is never a virtue nor is it a compliment to the software's designer.

→ More replies (5)
→ More replies (14)
→ More replies (1)
→ More replies (58)