8 ms·
Stack Overflow: Helping One Million Developers Exit Vim (2017)
- tempodox 8y agoHow the heck is this not covered in CS 101? Or any coder bootcamp? Or Udacity? At least there has to be a node.js package for this.
- phakding 8y agoFirst time I used vim more than a decade ago, I got stuck too. Kill vim from other console and then googled it for future reference.
- sureaboutthis 8y agoA professional would use the man page.
- codetrotter 8y ago> A professional would use the man page. A professional would verify that the man page contains the information that they snarkily told others to look for there before they told them to read the man pages. In this case it doesn’t. The closest you get to that sort of information from the vim man page is: > Type ":help" in Vim to get started. Type ":help subject" to get help on a specific subject. For example: ":help ZZ" to get help for the "ZZ" command. Use <Tab> and CTRL-D to complete subjects (":help cmdline-completion"). Tags are present to jump from one place to another (sort of hypertext links, see ":help"). All documentation files can be viewed in this way, for example ":help syntax.txt". So you need to find this portion of the man page, which is quite far down in the Vim man page, and you need to realize that it means you should type :help quit or :help exit. The information you get from those two are different btw because quit and exit mean two different things. That is quite much to expect from someone if they’ve confused their way into vim without being familiar with vim. On top of that, when you use :help quit or :help exit, the first time you use the command to quit or exit it will close the help text but you’ll still be in vim so you need to do it again.
- sureaboutthis 8y agoSo the information IS there but, in any case, a professional would not continue to stumble and fumble and give up on the editor as so many amateurs do.
- detaro 8y agoA professional would be able to reconfigure the system afterwards to make sure it'll never drop them into this annoying to use editor again.
- sureaboutthis 8y agoA professional isn't annoyed by vim.
- detaro 8y ago"Professional" isn't defined by taste in text editors.
- sureaboutthis 8y ago@detaro I agree. Thus all the downvotes from the amateurs.
- afiori 8y agoLook at the bright side, the less people use vim the more elitist you can feel.
- baq 8y agoA professional should expect to end up on an AIX shell or worse once in her career where it’s vi or the highway...
- joseph8th 8y agoTrue. A "professional" would obviously know to add `export EDITOR="emacs -nw"` to their `.bashrc` Problem solved! :D
- gdy 8y agoWhat kind of professionals are you talking about? Professional typists? They are unlikely to even know what man is.
- robjan 8y agoFor your reference: https://en.wikipedia.org/wiki/No_true_Scotsman https://en.wikipedia.org/wiki/No_true_Scotsman
- ericfrederich 8y agoWhat about tmux and screen?
- Aardwolf 8y agoWhat's all this stuff about colon keys and enter? Just ZQ (without saving) or ZZ (to save) :)
- alexpetralia 8y agoThis is probably the #1 problem with Unix-based systems in general for new users. There are so many ways to exit a command prompt depending on the application! Off the top of my head: Ctrl+D, q, :q, exit, quit(), Ctrl+C, Ctrl+X. Countless times have I been locked in an application and needed to cycle through those memorized commands to escape. Imagine doing that as a newbie.
- Aardwolf 8y agoctrl+d is the most dangerous kind! Since that one can also exit the terminal itself. gdb takes, depending on the situation, one time ctrl+d or two times ctrl+d to quit. It's a trap! So since gdb usually takes two times, muscle memory learns two times, but then in that rare instance where it required it only once... logged out of ssh :(
- bodyfour 8y agoIn bash: IGNOREEOF=10 In zsh: setopt ignore_eof In ksh: set +o ignoreeof In tcsh/csh: set ignoreeof Normally I just do this for login shells, so I can quickly exit out of subshells.
- vram22 8y agoSimilarly, to not overwrite an existing file when doing output redirection, there is bash's noclobber option. https://www.google.co.in/search?q=bash+set+noclobber https://www.google.co.in/search?q=bash+set+noclobber
- tasuki 8y ago10 ??? For bash I set `IGNOREEOF=1` so as to have to press ctrl+d twice to exit. Ten times seems a bit too many. How to do the same for zsh?
- pinouchon 8y agoYou forgot the most powerful of them all: Ctrl+Z followed by kill -9 pid
- ensiferum 8y agokill -9 `pidof vim` Also, whoever decided to have vim as the default editor in the windows port of git.. this is brain damaged. Just use notepad already!
- Aardwolf 8y agoGiven that notepad only supports unix newlines since a few months ago, I can see why that one wasn't the default
- improbable22 8y agoSure, why not something like pico / nano? Seems more friendly to occasional users, who are the people most likely to hit the default.
- airstrike 8y agoWould you drive a Yaris if you had a Ferrari in your garage? Didn't think so
- nkozyra 8y agoI'd rather drive the Yaris to pick up groceries and the Ferrari to movie premieres and races. I don't see much value in having an Uber powerful editor for git commits.
- kazinator 8y agoThere is value in having just one editor. Some developers perform fairly complex edits when preparing commit messages.
- improbable22 8y agoAbsolutely, but those ones will already have pulled in their usual configurations. In cars, it's more like your airbnb host tosses you the keys & asks if you can park it in the basement quickly while he opens up. Much better a Yaris than a stick-shift V12 monster with no rear window.
- dmos62 8y agoI was always fascinated by the different groups in programming and the huge differences between them. Frontend developers contrast with backend app developers, but not nearly as much as frontend and low-level programmers. It's a bit like human races or animal species that evolved differently due to differences in environment and challenges faced. If you look at the global programming community its diversity is huge. I can't help but find that deeply inspiring.
- torgny 8y agoWhy is this such an issue? It is no harder exiting vim than it is exiting plain old vi, nvi or any other vi clone. In fact, the very same keystrokes that you use for exiting vi can be used in vim as well.
- thosakwe 8y agoDid you consider the case where the user has never used any vi variant before?
- sureaboutthis 8y agoThen why the hell are they using Unix at all?!
- afiori 8y agoLast time I checked there was no questionnaire to download any distro.
- sureaboutthis 8y agoThat has nothing to do with the subject or my comment.
- mario0b1 8y agoit's still not much harder. Just press F1, like in most applications or type "<programname> cheatsheet" into your favorite search engine. Takes less than a minute to figure it out.
- paublyrne 8y agoI assume people type 'quit vim' into their favourite search engine as that's a shorter search term, and get the SO link. I don't think many people actually search SO directly.
- JeremyBanks 8y ago
- thosakwe 8y agoHot take: Vim should include a simple “Type :qa!<enter> to quit” line in its startup message. Something makes me think it would clear up a lot of confusion for first time users. EDIT: I notice now that it has a “Type :q to exit.” I never noticed that before, and I use Vim most days, so I can see how others might miss it too.
- dijit 8y agoIt does this when pressing control+c (a common kill key combo)
- sureaboutthis 8y agoAnyone easily confused by how to quit vim should not be using a computer at all, much less vim.
- lucideer 8y agoPeople with this attitude shouldn't be using a computer, for fear they might get into software development and alienate an entire swathe of potentially great engineers.
- sureaboutthis 8y agoI sincerely hope that I do eliminate such people who can't figure out how to quit out of vim.
- nkingsy 8y agoI got fight and flight but wasn’t lucky enough to inherit the vim key bindings. Darn parents!
- somebadguy 8y agoYou’re just a bitter incel. It’s not the world’s fault that you’re a social outcast.
- 8y ago
- rini17 8y agoMaybe it should be more visible in default configuration. Something like the cheatsheet that is always shown in nano? When I got stuck every time in neovim's terminal - fixed it by adding the shortcut into statusline (there was empty space anyway).
- airstrike 8y agoI swap ; and : in my .vimrc and I often get stuck for a moment when in ssh cause I never remember to hold shift... then I end up entering into the command line by pressing q: accidentally...
- Datenstrom 8y agoWhenever I end up on another computer without my environment setup and end up in nano because it is the default, it always takes me a while. There is the cheat sheet at the bottom but as soon as the text appears I'll start manipulating it using vim keybindings and delete things and whatever else randomly. I always assume my fingers were not on the homerow correctly or something first. It is very disorienting. So I imagine it is far worse for someone who ends up in Vim the same way.
- tyingq 8y agoThis usually happens to me on a fresh install the first time I run "crontab -e" or a git commit.
- SomeHacker44 8y agoMy first command in any new install is the equivalent of: dpkg --purge nano 31 years of exiting vi FTW.
- c22 8y agoThis happens to me even in graphical text editors, my text ends up riddled with ':w's I have to go back through and remove later.
- phissk 8y agoSame for me :)
- hirundo 8y agoYou just reboot the computer. The problem is that when you want to close Vim on a server and so call the sysop and ask him to reboot, he gets all testy. Not a team player.
- kemiller2002 8y agoI always restart 3 times just like the sysop told me to.
- snazz 8y agoIt’s best to power off and then quickly flip the on/off switch a bunch of times. As a bonus, you get to stress-test your power supply!
- deleted 8y ago[deleted]
- genbit 8y agofirst stuck in vim 13 years ago. No internet, no GUI, could not speak english, 1 book on unix/linux. So I had to reboot (hard reboot) computer, three times, then re-install OS, since something broke because of hard-forced reboot.
- ajross 8y agoHah. First stuck in emacs ~26 years ago, on a dumb terminal (want to say VT-102, maybe the VT-220's that were in the adjoining room). Tried everything to get out of it with no success, was too embarassed to ask for help, and eventually just power cycled the thing and walked away sheepishly. Don't believe I ever got stuck in vi. All the cool kids were emacs users and it was years before I bothered to learn it.
- genbit 8y agoemac I tried as well, and then power reseted it too :D
- acomjean 8y agoI had the same issue doing a cvs commit where I got stuck in vi. I didn’t know what it was and what to do. I had to quit the terminal. It was not a good hi experience. I think vim and emacs come with basic instructions on the splash screen now to help newbies.
- varjag 8y agoTo use vim properly one must realize it's modal editor with two modes: beep, and ruin everything.
- dustinmoris 8y ago> China, Korea and... > 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. Or it might mean that in China and the Republic of Korea people don't use StackOverflow as much as people in other countries for whatever reason (they have their own version, censorship, low page rank in their own search engines, etc.)
- Mugwort 8y agoHow is this even possible? I used EMACS for years and had no trouble understanding Vim. Who's hiring these developers who can't even exit Vim? Is this even a real story or the Onion?!? OK, it's real. I need to go outside and get some fresh air. This is simply too shocking.
- faitswulff 8y ago> I used EMACS for years Probably not a great representative sample
- kemiller2002 8y agoThis is totally anecdotal, and I'm not making fun of them. Most of the time when I talk to people who have no experience with Vim, they develop apps on the Windows platform. (They use Visual Studio.) They just haven't been exposed to it. They don't need to learn it. Until several of them started using Git, there was absolutely no need to ever touch it. This isn't every Windows developer. I'm sure there are several who know it, but that is my experience.
- blensor 8y agoAnd how should someone who has never been exposed to vim know how to use it without consulting any kind of reference (whether it is SO or any random unix sysadmin on the street you can hit over the head and drag home to your workstation)?
- abbe_k 8y agoWhy do you necessarily think they are all hired developers? I find it surprising that you and many others are surprised and even upset by this story. Imagine someone never having used vim, maybe new to Unix overall, or new to terminal programs. Maybe this person is a student and is trying to learn. In some way he ends up in vim and it is not very intuitive how to exit it. The person searches for "how to exit vim" and find that SO thread and learns how to exit vim. Does that sound so weird? If you act in a similar way towards colleagues trying to learn something new you should rethink your behavior.
- waynecochran 8y agoMy first year of grad school I was a TA for a first year computer science course that was often taken by students from a variety of majors. The first editing sessions I spent the whole lab time running around help students with frozen vi editors. The main problem is you don't start in "edit mode" and students expect to be able to just start typing (which is a reasonable expectation). Who knows what "command" they just invoked -- sometimes I just "ctrl-z, killall vi" I learned to hate vi.
- ecocentrik 8y agoThat sounds like someone's idea of a practical joke. Assigning vi as a default editor for first year CS students has to be an efficiently cruel way to clear out an overpacked classroom for the semester.
- ianai 8y agoFor the cost of tuition, that should be banned.
- ghtrytttttnsa 8y agoPaying tuition should in no way make earning your degree easier. In fact, basically just the opposite, since nobody respects your degree if it was just sailing through a piece of cake with the help of money. I just love practical jokes like this, and I'm not alone. In real life the struggles are much bigger so if you cannot handle the small ones like this your future is not looking bright.
- leggomylibro 8y ago"Weed-out" classes are pretty common across subjects, though. I remember taking an introductory course in our undergraduate pre-med track which was basically just a new presentation about novel research every week. The exams would be on these fairly specialized papers which most first-year students were at a loss to understand, so they ended up being exercises in rote memorization. When some of us complained to a TA that we didn't see how we could learn enough to understand the concepts without just memorizing key points and angling at the professors to find out what was important, their response was something along the lines of, "then are you really sure that you want to study biology and medicine for the next umpteen years?" On the other hand, I hate telling people that a field "isn't for them" just because they don't feel like putting up with the bullshit which has accreted around the way that a subject is currently taught. Personally, I'd like to see an introductory class about how to effectively search for answers online, find useful sources, ignore ads and obvious SEO-gaming, etc.
- Reason077 8y agoHere’s the proper fix. In your .bashrc, or wherever: export EDITOR=<anything but vim>
- Mugwort 8y agoVim works fine. I use EMACS. TextMate, Atom and Sublime are OK. Any mainstream editor is fine is all but a few corner cases. Truth be told I would be fine without EMACS but maybe less happy. People unable to exit Vim is just a sign of a larger problem, that a generation of programmer relies more on Google and Stack Overflow than simply READING documentation and EXPERIMENTING by writing short little throw away programs. There is so much Vim material out there on the internet that it makes me afraid these defective programmers can't even use Google properly. I still look shit up on the internet all the time but 99% my answer is right in the documentation. Anyone who can really program is horrified by idiots who can't shut off Vim or use WordPad to write c programs and try to compile them.
- tyingq 8y agoThere's a bit of irony here. You're poking fun at people stuck in a new unfamiliar environment doing the wrong thing over and over without looking into why it isn't working. Somewhat similar to how most of your comments here are down voted and/or dead/flagged, yet you keep posting new ones with the same tone.
- koonsolo 8y ago> Anyone who can really program is horrified by idiots... I think you should take a broader look at the world. > these defective programmers can't even use Google properly. Try searching "how to exit vim" in google... see what the first result is... . If everyone around you looks like an idiot, you can probably figure out who the real idiot is. Or maybe not. But hey, maybe you're a natural talent who knows by instinct how to exit VIM.
- manjana 8y agoOr just learn the very basics of the program: Ins to write Esc to enter command mode Shift+V while in cmd mode to select lines, d to cut or y to copy selected lines. p to paste. u in cmd mode to undo, ctrl+r to redo. :q! to quit and discard changes when in cmd mode. :qw to quit and write changes :w to write changes and no exit. It aint that hard really, once you get the hang of it :) - And then I would suggest changing default editor if you still wish.
- based2 8y agoSave and quit ESC :x https://ss64.com/vi.html https://ss64.com/vi.html
- based2 8y agoOpen @ line: vi +2019 myfile.txt
- MagicPropmaker 8y agoYou would think that those zealous power-mods on StackOverflow would have closed this as "not a programming question"
- nicoburns 8y agoI think this question predates that era of stackoverflow. Early stackoverflow was a lot morw tolerant of these kind of questions.
- Anthony-G 8y agoEven though https://vi.stackexchange.com/ https://vi.stackexchange.com/ has been around for a couple of years, questions about Vi/Vim are still considered on-topic on Stack Overflow. I presume it's because a text editor is so fundamental to programming – though questions using and configuring Emacs, not specific to programming, should be asked on https://emacs.stackexchange.com/ https://emacs.stackexchange.com/ Questions about other programming tools such as IDEs are also on-topic and there are specific tags for such questions.
- randomsearch 8y agoI guess whether vim is poorly designed is up for debate. It’s a power user’s tool, so maybe you sacrifice intuitive behaviour or an elegant learning curve for a more powerful tool once you’re familiar with its design. Less controversial is that any design where vim becomes the default editor, but the user may not necessarily be familiar with vim, is a bad decision. I can’t think of a justification for that.
- MagicPropmaker 8y agoIt's the same way you exit ed and TECO. Kids today don't know anything.
- hasperdi 8y agobut kids these days know other things that you don't. They don't know it because it is not relevant enough to them and vice versa.
- ghtrytttttnsa 8y agoKnowing basics of UNIX is relevant to everyone who wants to be called an IT professional. Exiting vim and emacs is general knowledge and you should be ashamed of yourself if you complain about it.
- sly010 8y agoThis is something that the most hardcore vim users couldn't ever figure out. That's why they are still vim users.
- eruci 8y ago:q
- Mugwort 8y agoIf you can't turn off Vim and you're a paid professional programmer, then QUIT. If you downvote this you deserve every bit of suffering coming to you working with these people who can't turn off Vim. If you downvote this you probably can't turn off Vim yourself. If you downvote this you're to dumb to even look stuff up on Google. Vim even give everyone a :help with links to a tutorial which explains :q :wq :q! etc. RTFM is at least 50% of what makes a good programmer. Nobody is above reading documentation, no matter how smart you are.
- ensiferum 8y agoTroll
- alkonaut 8y agoWhen I first entered vi/vim I had no idea what it was. To know how to exit vim you first have to know that’s what you are trying to exit. I suspect at least half of the confusion comes from people accidentally entering vim without any intention to do so. One of the most common examples is git that some times launches a text editor and in some conditions that might be vim. If you are doing a “git rebase -i” for the first time in Cygwin and you never used another linux/Unix shell before (very common in Windows-only devs, which are a significant portion of devs), then being greeted by some “~” characters, a cryptic status bar and Ctrl+C doesn’t exit - then you google. You don’t even google “How to exit vim”, you google “How to exit git rebase” or similar. Now, if you launched vim, then the story is different. Then you know what you started. You can at least know WHAT manual to read. But as I said I’m guessing a large number of those can’t leave vim had no intention to start it either. I must have started vim hundreds of times, almost none of which were deliberate (misconfigured editors on vm’s etc). A lifelong windows user typically wants to use nano or similar.
- Cyphase 8y ago(This is a reply to the GP comment, since it got flagged while I was typing my reply.) --- > If you downvote this you're to dumb to even look stuff up on Google. What do you think the first result is when you search for how to exit Vim? > RTFM is at least 50% of what makes a good programmer. Stack Overflow is part of the metaphorical manual.
- Mugwort 8y agoHow to turn off Vim... Hmmm.. LMGTFY
- Mugwort 8y agoThe Russians probably hacked into your computer and that's why you can't turn off Vim.
- wslh 8y agoThis is the kind of myopic discussions that ignore that people are different and have different tastes. It amplifies the false sense that at the end there is always the same unique and best choice (for everyone) in a top-10 list.
- ShepherdKing 8y agoI really love my vim bindings, I try to use them everywhere possible. So far that is: Web browser: Vimium plugin (Chrome) Music player: Cmus Terminal multiplexer: Tmux & Screen Terminal pager: GNU Less I'm still trying to figure out how best to use vim bindings in my z-shell (zsh) and ipython interactive sessions.
- kungtotte 8y agoFor zsh, just enable vi input mode? (bindkey -v in .zshrc) It starts in insert mode, hit esc to get to normal mode where your typical vi binds work. So instead of ^a to go to the beginning of the line it's <Esc>0
- ShepherdKing 8y agoI think the issue that I had was that my regular bindings in insert mode (CTRL-a) were disabled while in vi input mode, which caused problems for other shell programs. Plus, with Tmux and GNU Screen already re-configured with vi bindings, managing key binding collisions became complicated with vi input mode enabled. The bigger issue that I tend to have is managing copy-paste buffers between Screen, Tmux, and Vim.
- sd2k 8y agoYou may like [ptipython](https://github.com/prompt-toolkit/ptpython/blob/master/README.rst#I https://github.com/prompt-toolkit/ptpython/blob/master/READM... python-support) for vim bindings in an ipython(-ish) environment.
- grzm 8y agoDiscussed at the time (775 points, over 400 comments): https://news.ycombinator.com/item?id=14403036 https://news.ycombinator.com/item?id=14403036
- jrootabega 8y agoDid you know vim has an easy mode? vim -y Think you can figure out how to quit vim from easy mode? <C-O>:q!<CR> (from https://stackoverflow.com/a/27439752 https://stackoverflow.com/a/27439752)
- Doctor_Fegg 8y agoI always wondered why new MacBook purchasers were bemoaning the absence of the Esc key, a key I never use. Now I know.
- rdancer 8y agoCtrl-[
- avip 8y agovim is a modern app optimized for max user engagement.
- pknerd 8y agoOnly thise morning I was not even able to exit by using q! either. I did something good in my life or parents that some random keys hitting made me to exit it.
- BozeWolf 8y agoProbably in the wrong (input) mode? Does ctrl-s freeze vim?
- mshook 8y agoCtrl-S doesn't freeze vim, it freezes your terminal output (Ctrl-Q to revert it). It's handy when something is dumping tons of stuff in the terminal. Here's the explanation of where it comes from: https://unix.stackexchange.com/questions/137842/what-is-the-point-of-ctrl-s?answertab=votes#tab-top https://unix.stackexchange.com/questions/137842/what-is-the-...
- koonsolo 8y agoReminds me of the editor learning curves. The one of VIM is definitely correct :D https://www.ihaveapc.com/wp-content/uploads/2011/08/emacs_learning_curves.png https://www.ihaveapc.com/wp-content/uploads/2011/08/emacs_le...
- brandonmenc 8y agoAt this point in my life, the only vi command that I do remember is :q!
- PascLeRasc 8y agoThe only real command I know and use often is gg=G to fix indentation. It's a lot more reliable than Atom or Sublime's reindent, and this is coming from an Atom apologist.
- vfclists 8y agoThis means that 1 million developers need to do one or more of the below: 1. Switch to emacs (plain emacs, roll your own config - not advised) 2. Switch to emacs and learn adopt evil-mode 3. Switch to emacs and learn to configure it with use-package 4. Switch to emacs and install spacemacs, and configure it with step 3 5. Switch to emacs and install doom-emacs, and configure it with step 3 6. Take 4 then switch to step 5 7. Takes step 3, run it side by side with both 4 and 5, then switch wholly to step 3 1 million developers can have their cake and eat it. Vim, Neovim, VSCode, Sublime and IntelliJ and all other editors go into a slow death spiral. 5 years on: Emacs gains the abilities of all the other Lisp dialects, becomes the foundation for the McCarthy Desktop Environment. KDE, Gnome and Co go into a slow death spiral. 10 years on: Emacs is so advanced that programmers can instruct Emacs via brainwaves. Keyboards are not necessary. 20 years on: Emacs attains sentience. Emacs morphs into a 3 dimensional human form bearing an uncanny resemblance to Richard Stallman. Every Emacs user has their own Richard Stallman look alike at their beck and call. 30 years on: Cyberdyne's Skynet has attained sentience and threatens to destroy humanity. Emacs and Skynet duke it out. 40 years on: Emacs defeats Skynet. Emacs receives the Congressional Medal of Honor, The Victoria Cross, becomes a Peer of the Realm, and receives every award every single country of the world has to offer. 50 years on: Emacs brings peace on earth and goodwill to all men. Every man, his family and his dog live happily ever after. 60 years on: Emacs defeats both Alien and Predator 70 years on: Emacs colonizes new planets. 80 years on: Emacs attains nirvana and vanishes in an explosion of light. 90 years on: Human beings are back to Vim, Neovim and all those other horrible editors and desktop environments. The cycle begins anew.
- howtoexitvim 8y agoWell, okay. https://howtoexitthevimeditor.com https://howtoexitthevimeditor.com
- robotcookies 8y agoWell now the stats will get distorted as people reading the article check the question on stackoverflow. That is unless they have another way of gauging this. If I click that link to the question does that increase the count for the languages I use?
- kaustyap 8y agoLooking at the demographic representation of users worldwide, does it make sense to deduce that top 5 countries (Ukraine, Turkey, Indonesia, Pakistan, Vietnam) are ones with emerging software industries with many novice programmers and the countries at the bottom have well established industry with experienced programmers?
- luizfzs 8y agoJust went to the question again. The view count is 1,822,695