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

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)

6

u/Shaper_pmp May 23 '17

But if you read the first screenshot in the article, you'd know it doesn't always work that easily.

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

8

u/tomdarch May 23 '17 edited May 23 '17

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

Hmm... I started in a school computer lab that had teletype terminals (on a PDP mainframe edit:'minicomputer') and while my memories of that are pretty fuzzy, and very little of that VI/VIM stuff makes sense from that experience.

Can't we just admit that programmers without outside input on user interface tend to do goofy, arbitrary stuff ("seems obvious to me!") and that VIM simply includes some old, arbitrary decisions that were made decades ago and never corrected?

edit: Scroll to the bottom then try to imagine editing even a short program when every interaction meant printing a line or a few lines.

8

u/antonivs May 23 '17

Can't we just admit that programmers without outside input on user interface tend to do goofy, arbitrary stuff ("seems obvious to me!") and that VIM simply includes some old, arbitrary decisions that were made decades ago and never corrected?

That's really not true, though. This comment chain discusses why.

One core issue is that the Vim core is console-based, not GUI. If you use one of the GUI wrappers for Vim, then you can just use the GUI menu to exit like any other GUI app. But if you're in the console, the situation is less straightforward, and there are good reasons for Vim's behavior that are discussed in the above thread.

2

u/Stormflux May 24 '17

Possibly.

Here's my issue with VIM. I only ever see it because it's the default for git.

It should not require these crazy incantations just to edit a damn commit message or a short text file. Control S should save, always. Control Q should quit, always. The arrow keys should move the cursor, and I should be able to type where the cursor is. That's all I need in a damn git editor.

2

u/Andernerd May 24 '17

Then why are you using Vim as your git editor? It's not the only option, you know.

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

2

u/phero_constructs May 23 '17

Well, even modern Ubuntu apps don't follow the ctrl q or w convention.

4

u/minimim May 23 '17

They don't because they follow a convention about how a terminal works that dates back to 1960.

11

u/crixusin May 23 '17

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

Vim is constantly being updated, yet they keep their shortcuts in the 70s? Talk about being stubborn.

130

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

The whole point of Vim is the shortcuts. If you changed or removed them then there would be no point in using Vim.

When you take the shortcuts away, Vim is actually pretty shit. Front end is shit (not because it's terminal, for example Emacs is significantly better than Vim in this regard). GTK front end is shit. VimScript is dog slow. Vim integration with tools is often blocking, flaky, and awful (although improving since NeoVim). No single standard way of handling plugins which is decent (so people use different non-standard ways, but they do work well).

It has instant startup time, but so do plenty of other old editors that date back decades. Plenty of editors also have a headless mode which makes it a non-issue. Constantly tweaking your editor setup to your needs on the fly as you want it is really fucking cool, but lots of editors also have this. That includes modern editors like Sublime, Visual Studio Code, and Atom. So these positives aren't unique anymore.

Only reason people use it is for the keyboard interface. Only reason I use it is for the keyboard interface. Because that's what it got right. That's the magic in Vim. That's it.

75

u/wasabichicken May 23 '17

Only reason I use it is for the keyboard interface. Because that's what it got right. That's the magic in Vim. That's it.

I think it's a bit of a broad statement. One attempt to narrow it down that I heard, and one that I agree with, targeted Vim's composabiliity:

Emacs only has two of these functions: kill-word and kill-line. Atom has the same two, more or less: deleteToEndOfWord() and deleteLine(). Vim, though, is different. Vim only has one command: d, which is “delete.” What does it delete? You name it, literally. The d command gets combined together with those commands for movement: dw deletes to the next word, d$ to the end of the line, dG to the end of the file, and d} to the end of the paragraph. This is where Vim’s composability leads to its power.

21

u/[deleted] May 23 '17

I think that's something that isn't conveyed well to people unfamiliar with Vim. Vim doesn't have 'shortcuts' like most other programs, it's much more akin to a language. Vim's power is in your ability to basically tell it how you want to manipulate the data.

Using the above example, pressing d is like telling it "delete" and it's looking at you like: "Ok... what do you want to delete?" So di" is like telling it "delete everything inbetween the quotes". You can string together much more complex 'sentences' to achieve what want to do, and that's why so many people enjoy using it.

10

u/TRiG_Ireland May 23 '17

I have seen people answering code golf questions in vim script commands.

→ More replies (4)

21

u/jl2352 May 23 '17

I agree. The shortcuts go a lot deeper than just yy for copy line and p for paste, which I didn't get into. Composability is the real corner stone of why the shortcuts are so amazing which I didn't go into.

→ More replies (3)

46

u/Deto May 23 '17

Eh, the whole point of Vim is the keyboard shortcuts. Exiting Vim makes perfect sense given the Vim way of editing code. Vim has a pretty steep learning curve, but that's just because of how different it is and that difference is directly tied to why people use it in the first place. It just doesn't really make sense to optimize for first-timers or people who stumble into Vim accidentally (and really probably should be using Nano instead). It'd be like if Photoshop got rid of layers because people coming over from MS Paint found them confusing.

→ More replies (3)
→ More replies (20)
→ More replies (44)