Stack Overflow: Helping One Million Developers Exit Vim

by David Robinson

on

This morning, a popular Stack Overflow question hit a major milestone:

You’re not alone, jclancy. In the five years since this question was asked, there have been over a million other developers who got stuck in Vim and couldn’t escape without a bit of help. Indeed, the difficulty of quitting the Vim editor is a common joke among developers.

I’ve been told by experienced Vim users that this reputation is unfair, and I’m sure they’re right (even I’ve gotten the hang of it in the last few years). I think there are two reasons it’s easy to forget how to exit Vim: developers are often dropped into Vim from a git command or another situation where they didn’t expect to be, and they run into it infrequently enough to forget how they solved it last time.

In honor of this milestone, we decided to take a look at the data surrounding this question. In particular, we’ll try measuring who is most likely to get stuck in Vim as opposed to using it intentionally, and examining how that balance varies by country and by programming language.

How many people have been struggling to exit Vim?

In the last year, How to exit the Vim editor has made up about .005% of question traffic: that is, one out of every 20,000 visits to Stack Overflow questions. That means during peak traffic hours on weekdays, there are about 80 people per hour that need help getting out of Vim.

Has the percentage of traffic it makes up changed over time? That is, have developers started learning to exit Vim on their own?

It doesn’t look like it. The question was asked in August 2012, and for a few months it got very little traffic. Then it began growing in the following two years, presumably as more sources linked to it online and it moved to the top of search engine results. It’s been relatively steady for the last two years. This doesn’t necessarily mean the same people visited it again and again, of course; it could represent relatively new programmers getting stuck in Vim for the first time.

Differences across countries

As we saw in a previous blog post, we can use Stack Overflow traffic to learn a lot about the geographical distribution of developers.

Let’s consider what percentage of visits to Vim this question comprises within each country. In countries with a lot of experienced Vim users, we’d expect this percentage to be low. When it’s high, it indicates many users got stuck in Vim when they didn’t necessarily expect to.

It looks like developers in Ukraine, Turkey and Indonesia are getting stuck in Vim quite a bit: it makes up a larger portion of their Vim questions than in any other country. In contrast, in China, Korea and Japan the fraction going to this question is one-tenth as much. That might indicate that when developers in these countries enter Vim, they usually meant to do so, and they know how to get out of it.

What kind of programmers get stuck in Vim?

It’s also likely that users of different programming languages will have different experiences with Vim. We can investigate this by stratifying the “Exit Vim / Total Vim” percentage across each user’s main programming technology.

We’ll define this based on what Stack Overflow tag they visit most often. (For instance, my most visited tag is R: it makes up 52% of my question views). It’s not a perfect measure, but it’s reliable enough to give a sense of the breakdown by language. (For this analysis, we considered only registered users with at least 100 visits to the site).

The developers who are most likely to get stuck in Vim are front-end web developers: those who primarily visit tags like JQuery, CSS, and AngularJS. They’re followed by Microsoft developers (C# and SQL Server) and mobile (Android and iOS). These developers usually work with an IDE (Visual Studio, Eclipse, Xcode, and so on), rather than a plain text editor, so it makes sense that they’re relatively more likely to get “stuck” in Vim rather than to open it intentionally.

The developers least likely to get stuck in Vim are those who program in C, C++, Python and Ruby. These languages make sense to me: they are a combination of low-level languages and scripting languages that are often used with a plain text editor rather than an IDE, so they have the experience to escape it without a Google search.

Conclusion

I was amused when I saw this question approach a million visits, but I was also proud that I work for, and contribute answers to, a site that helps so many developers. You never know when an answer you contribute could help millions of people, whether it shares how to undo a git commit or how the yield keyword in Python works.

If you want to contribute yourself, we encourage you to join the world’s largest developer community, whether it’s to ask and answer questions, get your next job, or build your online presence with a Developer Story. You can also use tools like Stack Overflow Trends to learn more about what our data can tell you about software developers.

In any case, next time you solve your problem through Stack Overflow, remember the hundreds of thousands of users who regularly ask, answer, edit, and moderate the site to make it all possible.

  • Vijay Kumar Attri

    Good read. 😀

  • Anirudh Mathad

    VIMter is coming!

  • Jon

    The guy that wrote the original answer is the chief architect of MaidSafe!!

  • Alejandro Matias Ravasio

    “For instance, my most visited tag is R”
    After this post, I am not surprised. :v

  • vivekgani

    Brilliant, but where’s the Larry Tesler #nomodes reference?

  • Morgan Feldon

    I could memorize how to use Vim. I’d just have to erase my childhood and other unnecessary memories to make room. Hopefully it works out better for me than Keanu.

    • Dutchie

      using vim has been the only worthwhile childhood memory for me.

  • I’m always searching at SO how to “visual block edit in vim”. Tried to memorize, but always failing to do it correctly from first attempt 🙂

  • DimaNYC
    • Josué Morales

      jajajaja

    • Irvandoval

      lol

  • Cameron

    I love that this is a thing

  • Tilghman Lesher

    Could be worse. They could be stuck trying to exit Emacs.

    • Bishop Clark

      That WOULD be terrible — if you’re trying to leave, you’re not using it right.

      • Tilghman Lesher

        Could even be worse. They could be trying to save on a terminal with software flow control.

    • Lliamander

      Lol! I remember the days of first learning Emacs…, but at least Emacs at least has a navigable menu bar with mouse support (even in TUI mode). Of course, using it is shameful thing one should never admit to ;).

  • `:q!`

    • Heath Snoek

      Always save you work, you dolt!

    • DimaNYC

      I am a `:x` kinda guy

    • S Stewart

      I’ll take :wq thank you very much.

      • Mark Anderson

        depends. Did I accidentally open something? but yeah, I find myself doing :wq in atom all the time.

        • kbielefe

          Well, in these users’ cases, it’s more like, “Did I accidentally open vim then type a bunch of normal mode commands that made a whole bunch of edits I have no idea how to undo?”

  • Braiam

    How it fares in per capita? Stuck in vim/vim users in country and stuck in vim/programmers in country?

  • This is hilarious. I want to see the OS breakdown!

    • Linux 100%

      • Frédéric Delaporte

        I would rather bet for a high windows percentage. Haven’t you read wholly the article? It even gives a hint at why we may guess that: Git dropping you to vim in some circumstances. It does that under windows too. There, windows dev having no knowledge of vi are very likely to get stuck. (I have only used Git under windows, but I am also a long time user of Linux. I was quite surprised when Git first dropped me in vim, but that was not an issue for me.)

  • DeAca

    My country is not in the list… is that meaning we never get stuck???
    🙂
    …or is it because we learn first to use kill -9 and then VIM?
    :-)…:-)…. :ZZ

    • jacks

      Your country may not have more than the 100 million visits needed to make the cut.

      • Koen Dejonghe

        your country (like mine) probably uses notepad.

        • DeAca

          Uhmmm…more like edlin maybe!
          🙂

  • Andrew Leach

    “In contrast, in China, Korea and Japan the fraction going to this question is a tenth smaller. That might indicate that when developers in these countries enter Vim, they usually meant to do so, and they know how to get out of it.”

    While users of Vim in countries with non-Latin, multi-byte alphabets might know how to quit the editor if they can get it to work, it may be that the number of users is tiny because getting it to work is hard, and getting stuck is the least of their problems with it.

    • Drew

      It may also indicate that SO is rather irrelevant in those countries, as is Google.

      • jacks

        It’s a percentage of vim users visiting SO, however. So it already accounts for people who are only visiting SO. How they actually calculated that, who knows.

  • This is great. Thanks for making this a thing.

  • I thought I would read an answer on how to switch to Emacs 8)

    • Ashok

      Same here, I thought SO is helping people move from vim to emacs, lol

  • Timothy Choi

    I think the reason Chinese developers are not getting stuck in Vim is because they’re not using Linux in the first place. Most of them are on Windows.

    • You can use Vim in Windows

      • mo

        It’s much less likely that a Windows user opens Vim accidentally and isn’t able to close it

    • From my experience, this does not hold true. 100% of my Chinese friends are all on Arch.

      • Timothy Choi

        The last time I had to work with Chinese developers was a while ago so I could be wrong, but then I was working on Discuz! so I guess the community is different.

  • Emacs is much worse. At least it is easy to remember for Vim (‘q’ for quit).

    • You’re treading dangerous water there my friend. Be careful 🙂

    • asd

      pfff windows, what a pleb

    • Spacemacs to the rescue.

    • Matt Williams

      Actually, ^X^C is the standard syntax for emacs…. on any platform I’ve ever used.

      • Mike

        Not in the actual Emacs editor itself. Run “emacs” with no arguments and observe the syntax in which shortcut keys are listed. But I guess you’ve never used the emacs platform. 😀

    • Actually it’s:
      Ctrl + X -> command mode
      Ctrl + C -> Terminate process (like a terminal process)

    • MadeInNY

      Emacs being non-modal doesn’t need you to change states before the commands you know will work.
      Intuitive is not a real thing. You’re gonna have to learn commands no matter what editor you use. So with emacs, at least you only need to type them once.

  • Cher Stewart

    #vimctimized

    • Luís Muniz

      LOL!

  • S Stewart

    I’m surprised the US or UK doesn’t get stuck very much to be honest.

  • jim lesperance

    quick way to exit of vim “`SHIFT q + q“`

    • Haures

      Triple single quotes, you bastard!

      • jim lesperance

        my mistake it’s not quotes its markdown back-ticks

      • jim lesperance

        my mistacke its not quotes its backticks

  • Schwechater

    If you’re still using Vim to code (instead of a modern IDE) you’re a. incredibly old b. incredibly good c. incredibly stupid or d. an incredible hipster.
    My guess is it’s 4% a & b and 96% c & d.

    • Mark Anderson

      You forgot e. All of the Above

      But to be honest I wind up using it for sysadmin tasks quite a bit. You always know vi will be there.

    • Bernd Paysan

      That’s vimctim blaming!

    • Néstor Espinoza

      You forgot e. lazy to learn another IDE. I’m 100% that one.

    • Koen Dejonghe

      I use the VIM plugin in IntelliJ for Scala and all other development. It’s bliss.

    • Donkey Puncherello

      This guy got stuck in VIM

    • a_horse

      phenomenal tactic to stick that “incredibly good” in there so that folk like me can’t quite justify a downvote

    • Martin

      What about Haskellers? It’s kind of the best Haskell ide with all the plugins. Although Atom is nooice for the job too.

    • Xiong Chiamiov

      I use vim because I’m an SRE, so I spend a lot of time working on various remote servers (often through several ssh chains). There’s really no good option other than a terminal-based editor for this, and if I’m going to spend a lot of time polishing my use of that toolset, I might as well use it the 20% of the time I’m local as well.

    • alavers

      vim *is* a modern IDE 😉

    • Chris Myers

      e) all of the above

  • Eion Robb

    Great post!

    :quit
    http://www.google.com
    how to exit comment
    help
    escape
    escape
    :quit
    :quit

  • Sublime to Intellij.

  • Mr. Xcoder
    • aaronchall

      Each data point seems to be a month, but if they showed months in the ticks, I don’t think they’d be readable.

  • Quickest way to quit vim: `Ctrl+z`. 😁

    • warren5236

      Then a quick reboot to remove the process. 🙂

    • Matias Fernandez

      Ctrl+z
      kill -9 %%

  • Matt Gracie

    Neophytes don’t understand that Vim has two modes: there’s “beep mode”, where any character just rings the terminal bell, and there’s “nothing mode”, where keys don’t seem to do anything at all.

    Hope that helps!

    • In my experience, not knowing how to use Vim results in a bunch of unexpected things, not nothing at all. What do you call that mode?

  • Hoppinglife

    One explanation for the lack of traffic from China could be self-selection – users from China have to penetrate language and often a firewall barrier to visit stack overflow, it’s possible that they are more experienced in general.

    • lowatt

      AFAIK, 1) stackoverflow is not banned in China at least for the past 5 years. 2) Most Chinese developers learn English since junior high school (7 grade). We need more data like ‘total number of visitors from each country’ to better explain it other than blindly guessing.

    • MrHublot

      As a Chinese engineer who currently works in US, I believe it’s because:
      1) developers are not comfortable talking/thinking in English even tho most of them started learning English since young ages.
      2) searching English contents using Baidu is a pain in the ass. It’s horrible. Nobody wants to do it. Besides, you can find the same answers to the same questions in Chinese fairly easy. So no traffic from these people to SO at all.
      3) People who do have the English skills and need for answers of more complicated questions will def use SO. But then again, those are very unlikely click on questions such as ‘how to quit vim’.

  • Toni Lähdekorpi

    ^C^C^[^[^C^Z^[qqQ!qQ^C:q^C^C^[exit^Cquit^[^[:quit^C^C^C^[^C^C^[[3~^[[3~qqqqqqfqqffuuuuck

  • TerryGauchat

    Ukraine based criminal hackers should not be assisted in configuring malware. How about telling them to go fornicate themselves? (Ukraine is the #1 source of all malicious attacks against WordPress and other websites over the past year or two).

    • The criminal hackers do their crimes without at least a VPN tunneling them to some other country?

      • TerryGauchat

        Perhaps, but:
        1. A lot of these criminals are not sophisticated. They are just contracted by larger organizations to distribute malware. They use vim to set up configuration files.

        2. If Ukraine is hosting VPN providers for these individuals and organizations, then they are culpable accessories to crime.

        • They use Vim to set up configuration files, but they don’t know how to use it?

          • TerryGauchat

            Doh! That’s the whole point of this Article. Apparently thousands of vim users do not know how to “exit vim”. And yes… I can fully believe that thousands of people in Eastern Europe are joining the criminal hacker “industry” with minimal computer skills … including needing to learn “how to exit vim”. This is just a theory as to why the traffic for that query is so high from Ukraine. There is obviously a correlation; but not proof.

          • I realize that’s the point of the article, which is why I brought it up. If they don’t know how to use Vim, they probably don’t use it for their configuration files. It’s most likely for something they don’t do very often.

          • EE

            The question may be curiosity-driven. In Eastern Europe, such things as VIM are fascinating, but we’re rarely interested enough to get systematic knowledge of them.

    • Thor Heyerdahl

      I’d say front-end developers stuck in Vim are quite unlikely to be malicious hackers.

      • TerryGauchat

        A lot of these criminals are not sophisticated. They are just contracted by larger organizations to distribute malware. They are told to use vim to set up configuration files.

  • Charles Wolfe

    Habitually I press ESCAPE then :wq! kids these day, geeze

    • David

      you should be using :x!
      It saves a key stroke.

      • Random832

        ZZ

      • Iván Castellanos

        Don’t use VIM at all, it saves ALL the keystrokes

      • Kurt Mueller

        Could also do just :q!

  • Léo Martin

    Vim and Bc are too good for SIGINT

  • We’ve all been stuck inside vim at least once in our life.

  • Tomás Castro López

    :! sudo rm -rf /

    • Chris Myers

      pure evil

      • ProgrammingNewbie .

        pretty much, who takes joy out of that? There might be noobs reading this….fucked up

  • Drop Message

    Getting out of Vim is easy. Getting stuck in ex mode is where the true depths of hell lie!

    Also: I love that this page is a thing which exists. Just what my day needed.

    • Gabriel Laughlin

      Or when you start pressing buttons and find yourself in ‘recording’ mode, whatever that is. I usually just restart my computer haha.

  • Albert Gomis Verdu

    what’s wrong with nano?

    • everything

    • Graham Harwood

      How much time do you have?

    • Jacob Lindquist

      It’s not Pico

  • AzSandrat

    :wq

    • and then some

      What if you don’t want to save your changes? :colbert:

      • sergeydgr8

        :q!

        • and then some

          Yeesh, no need to get uppity about it! 😉

      • Drop Message

        Just FYI:

        E492: Not an editor command: colbert:

  • the root

    open a new shell; killall vim

    • Eugene Naydenov

      But more reliable is to execute `reboot` in a new shell. 😀

  • Santiago

    I have more trouble exiting nano

  • Odd Dahl

    The hell when you forget to add a commit message to your commit… wooh.. git has some shitty ways of doing stuff

  • Eric Zeller

    For me vi/vim is easy – it’s second nature…
    I can’t say how many times I’ve typed ZZ into notepad though….

  • Aldo Fregoso

    > That might indicate that when developers in these countries enter Vim, they usually meant to do so, and they know how to get out of it.

    I don’t know, maybe they’re more likely to write “如何退出vim?”

    • Shane Xie

      or they don’t even use SO.

      • Milutin

        considering the population density, chances are that there’s someone near who knows how to exit 😛