How Do You Exit Vim? A Newbie Question Turned Tech Meme – The New Stack
A decade ago, a programmer asked on Stack Overflow how to exit the decades-old Vim open source text editor, and the question has since become a cultural touchstone of the modern development experience.
Maybe it’s proof that the 50-year-old text editor has retained its popularity — that it’s now part of the shared collective experience of the developer community. (Vim is a 1991 clone of Bill Joy’s vi editor created in 1976, to serve as the visual mode for a line editor called ex. It was included in the initial Berkeley Software Distribution [BSD] Unix, released in 1978 and has been in the Unix/Linux developer’s toolbox ever since.)
But it also speaks to a larger truth, a fond and knowing acknowledgment that mastering Vim requires taking the time to educate yourself on its shortcuts and functionalities. Maybe there’s some secret pride in the fact that as powerful as Vim may be — there is still a learning curve. Getting trapped in Vim in a decades-old text editor remains a common if not universal experience for struggling first-time users.
I’ve spent the next 15 minutes exiting vim on 7 different machines.
— Tomasz Łakomy ? cloudash.dev ?? (@tlakomy) August 27, 2018
Basically, it’s an essential function that can’t always be executed in an intuitive way. When you’re typing away in Vim, it won’t accept commands like “q” for quit until you first hit the escape key — and even then, commands like “quit” are preceded by a colon.
A wise Linux greybeard once pointed out to us that Vim is no different than Microsoft Word in that both have two modes. One is a command mode to save files, add formatting, quit the program itself, and such. And there is the edit mode, where you write your code, book proposals, etc. The trick is to learn how to effortlessly toggle between the two.
Yet, so many novice users have gotten tripped on exiting Vim, that the instructions are now displayed prominently on its welcome screen when the software is launched — even before the Help command.
And typing Ctrl-C twice in Vim now pulls up a hint at the bottom of your screen.
But over the years, the difficulty became the affectionate target of some gentle geek satire. Currently, GitHub even shows 77 contributors to a repository titled “How to Exit Vim.” For example, one suggests the best way is to edit your shell’s alias file so that “vim” gets mapped to a command launching vim processes that time out and end after exactly 600 seconds. (“Make sure to save regularly.”)
A 2019 YouTube video shows an even more convoluted solution. It involves suspending the foreground Vim process (using Ctrl-Z), and then pulling up a list of all active processes (using ps ax), grepping for all the processes containing the string vim — while filtering out that grep process (which also contains the string vim) — and then using Awk to format the results so an xargs comand can kill the Vim-running process.
Preferred way of exiting #vim?
— Josh Boyd (@joshboyd) September 20, 2018
There’s also a joyful thrill of recognition when geeks stumble across reminders of just how common the problem may be.
Ten years ago someone asked “How do I exit Vim?” on Stack Overflow — and in the decade since the question has been upvoted 4,786 times (and bookmarked by Stack Overflow users over a thousand times). Answers to the question have been lovingly maintained and curated over the last 10 years. And while it took almost five years to reach 1 million views, in the five years since it’s received another 1.7 million views — for a total of 2.7 million.
Last week Reddit users couldn’t resist celebrating the 10th anniversary of the question. After the URL to the original question was posted on Reddit’s programming forum, it drew over 5,000 upvotes — and another 660 comments.
Yet mixed in with the comments were some genuine appreciation for Stack Overflow’s answer. “That answer is what in fact made me properly consider Vim ten years ago,” remembered one commenter. “Ten years later, still one of the best accidental software decisions in my CS journey.”
And another commenter felt Vim didn’t deserve its reputation for a steep learning curve, since “it’s sometimes inflicted on innocent users who were just trying to carry out a git commit. I’d bet that that makes up at least half of the views for that question.”
The question received a special acknowledgment in May of 2017 on Stack Overflow’s blog — when it achieved a special milestone. “You’re not alone…” wrote Stack Overflow data scientist David Robinson. 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.” That actually accounted for one out of every 20,000 visits to Stack Overflow’s questions.
“That means during peak traffic hours on weekdays, there are about 80 people per hour that need help getting out of Vim.”
“If you win you get to exit vim”
“What’s the game?”
“Exiting vim” pic.twitter.com/vapdZlhUNK
— SwiftOnSecurity (@SwiftOnSecurity) April 29, 2020
The Demographics of Getting Stuck in Vim
Robinson also couldn’t help acknowledging that the question itself has now attained rarefied status as a techie meme.
I’ve given up exiting Vim. I just buy a new laptop each time.
— Paul J Stales ??? (@pauljstales) August 3, 2022
But the post also delved into the demographics of those million views (“in honor of this milestone”). Interestingly, in 2017 the country where visits to question represented the highest percentage of all Vim-related question visits was Ukraine (followed by Turkey, Indonesia, Pakistan, Vietnam — and then Russia). The United States ranked #21 (behind Australia, and just above India).
Robinson also calculated the top visitors by which area of Stack Overflow they visited most frequently (based on the area’s tags), hoping to break down Vim exiters by their “main programming technology”. The results? “The developers who are most likely to get stuck in Vim are frontend 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).”
I’ve been using Vim for about 2 years now, mostly because I can’t figure out how to exit it.
— I Am Devloper (@iamdevloper) February 17, 2014
The post speculates Microsoft developers usually work with a full-fledged IDE, and may not be as familiar with simple text editors like Vim. In contrast, the developers least likely to get stuck in Vim were those whose main programming language was C, C++, Python or Ruby — languages which Stack Overflow’s data scientist believes are often written with plain text editors.
But the demographics don’t fully dispel the idea that it’s a pretty common experience to get trapped in Vim. And the jokes keep on coming — bearing testimony to that unique yet potentially confounding experience that can await first-time users of Vim.
how do i never see another exiting Vim “joke”?
— chantastic is away ? (@chantastic) April 24, 2021
Amazon’s Kindle Store features a humorous 23-page ebook on the subject — which the author has broken up into 19 chapters. (“Finally, a way to unlock the mysteries of quitting Vim without leaving a trail of destruction behind you.”) Its top-rated review calls it “A Masterful Feat of Concision,” and awarded the 23-page ebook a full five stars, in a possibly-sarcastic review.) “This book is an exhaustive treatise on one of Vim’s most common and least understood features, but it reads quickly and effortlessly. It will stand the test of time.”
Another reviewer tucked mock enthusiasm into their review’s title. “Exited Vim first try. Would buy again.”
And another joked, “I can’t wait for the second edition on how to access and use vim help.”
But alas, one reviewer awarded only four stars. “I would give this book 5 stars but I can’t figure out how to close it.”
— DEV Community ???? (@ThePracticalDev) June 28, 2016
Feature image via Reddit.
Credit: Source link