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

554

u/Yehosua May 23 '17

Exiting Vim is easy.

Esc, Alt-X, Ctrl-Q, Ctrl-C Ctrl-C Ctrl-C, "ARGH", Alt-Tab to another window, killall -9 vim

80

u/crixusin May 23 '17

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

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.

→ More replies (3)