4 ms·
How to Get Out of Vi (2015)
- biofox 3y agoI typed all of this out, and I'm still stuck in Vi. Please send help. /s
- proaralyst 3y agoI love that vi lost this part of the propaganda battle versus Emacs, when Emacs has the unintuitive ^C^X exit sequence. Maybe it also had a file menu?
- mouse_ 3y agoAnd I did not speak out, for I was a nano user.
- IggleSniggle 3y agoNow that everyone uses VSCode, who is left to speak for you?
- ok_dad 3y agoI still use nano! The nice part about it is that it shows the command keys at the bottom. I forget what it is to exit, but I don’t need to remember!
- IggleSniggle 3y agoAs it should be. I miss Windows 95 for stuff like this
- rdlw 3y agoNano is very supportive, any time I find myself using it it knows that what I need most is to "Exit" and "Get Help"
- deleted 3y ago[deleted]
- nequo 3y ago^X^C, but yes, Emacs also has a menu by default so you can click your way out of it.
- btdmaster 3y agoI was a bit confused when you mentioned this, but then I realised the actual sequence is ^X^C. It's because ctrl-X is a sort of metacharacter, and ctrl-C is used for the standard INT signal you know from other programs. And to be fair, GTK emacs has File->Quit as well (which helpfully reminds you you could use C-x C-c instead!).
- lencastre 3y agoI have a print of these commands stuck on a pinboard near me. For the 1 or 0 times per year I need to edit some config file on a machine where vi is the only sensible option.
- adtac 3y ago>vi is the only sensible option Of course, that's a tautology. What? It's flamewardnesday.
- pavlov 3y agoA rite of passage in the pre-Google time: your computer suddenly enters this unfamiliar editor and you have no idea what to do. (People who love getting hazed and being in cults are then converted into vim users, I guess.)
- idontwantthis 3y agoDid this used to be real? It’s just :q, or escape first if you aren’t in normal mode. Is this going over my head?
- xanderlewis 3y ago:q! if you’ve changed something since the last write.
- bauble 3y agoZZ if you're musically inclined.
- IggleSniggle 3y agoZZ and then afterwards `top` just to make sure you really quit
- dfabulich 3y agoMost users who struggle with this don't know that vim has modes, and often have found themselves forced into vim accidentally, e.g. having automatically launched vim by running "git commit." In order to quit vim, you have to understand the difference between normal mode and insert mode, and you have to understand the difference between :q and :q!. If you :q when you wanted to :q!, you're going to get this useless error message: E37: No write since last change (add ! to override) But if you don't know about :q!, "(add ! to override)" means nothing. Override what? How do I "add !"?? And since you're a total novice, it's likely that you don't even know that you haven't saved your changes to disk yet, so it's not clear to you that "No write since last change" is calling you to :w before :q. And if you try to explain all that, the user gets pouty. "I just want to quit vim! Why do I have to learn all of this stuff just to stop using it?!?"
- lbeckman314 3y agoAdditional methods for vi(m) users [0] :p [0]: https://github.com/hakluke/how-to-exit-vim https://github.com/hakluke/how-to-exit-vim
- foobarian 3y agoI'm surprised Ctrl-Z, kill -9 %1 is not on there :-)
- treve 3y agoAlso cq if you want to exit with an exit code, which is useful if Vim was launched to write a Git commit message.
- gweinberg 3y agoBad advice. Just :q not :q! Let it give you the warning and then hit :q! if you're really sure. Also, it's probably better to tell new vi users to write and exit with :w it works just as well and is more consistent.
- red_trumpet 3y ago:w only writes, doesn't exit. :wq writes and exits, or :x
- silisili 3y agoI use :wq always when saving and exiting so I can see and remember exactly what's happening, despite shortcuts existing. And :q when just exiting as you mentioned for exactly this reason. Tell me I'm quitting without saving so I can decide what to do next.
- mstudio 3y agoWhat's wrong with using :q ?
- Smaug123 3y agoTo a novice it appears not to work if you've hit Ctrl+S in your terminal to suspend output, for example. Ctrl+Q to release your terminal, Ctrl+C to return control to Vi if something else has it, Esc to get into normal mode if you're not already there.
- mstudio 3y agoThanks for clarifying. I understand this is a bit different, but if folks are using vim, the best resource (in my opinion) for novices is vimtutor. Just type "vimtutor" in the console. It uses an interactive tutorial to explain the basics of editing, saving, moving around — plus the various modes.
- deleted 3y ago[deleted]
- parentheses 3y agoI read this post in a sarcastic voice. Better that way.
- sp332 3y ago:!bash
- 38 3y agohttps://github.com/cabellwg/exit-vim https://github.com/cabellwg/exit-vim
- altercation 3y ago^[:q
- tambourine_man 3y agoThe real question is why would anyone want to leave Vim. If, by any chance, you've entered it accidentally, acknowledge the fortuitous twist of fate you've just witnessed and enjoy the enlightenment that is soon to follow.
- recursive 3y agoPerhaps because you want to edit some text?
- tambourine_man 3y agoThen you came to the right place and “recursive” is the best possible user name for such reply.
- stevenAthompson 3y agoI used vi once. In fact I still am, because I can't exit.
- deleted 3y ago[deleted]
- zogrodea 3y agoI was hoping this would be about someone who was stuck in/addicted to Vi and wanted to use another editor.
- omoikane 3y agoI am not sure why the advice starts with "ctrl+q". In insert mode, "ctrl+q" followed by "ctrl+c" will cause the literal ctrl+c character to be inserted, and ":q!" after that won't have the desired effect. Similarly for search mode. A better suggestion is probably to just hit Esc repeatedly to try to get back to normal mode, and exit via ZZ (save) or ZQ (don't save).
- troymc 3y ago"Did you try turning your computer off and then back on again?"
- not_your_vase 3y agoI have found a new "how-to-quit-it" challenge for myself in the past weeks. I use minicom to communicate with some devices via serial-over-USB - I also tend to suspend my machine while there is still an active connection. When I unsuspend my machine, often my serial connection changes address - and minicom complains that it can't communicate anymore. And here comes the challenge: `ctrl-a q` supposed to quit, but not in this state - it stays unresponsive to all combos I try. I literally smash all keys on my keyboard, and then `ctrl-a q` start working again for some reason. Maybe `ctrl-smash-everything-78-times` is an easter egg... oh well, I guess I will figure it out one day.
- TonyTrapp 3y agoMy personal "how-to-quit-it" challenge was Windows 8. I tried to approach it from the perspective of someone who has previously used Windows but is not a power user knowing shortcuts like Alt + F4 or Ctrl + Alt + Del. In the first Windows 8 versions, it was not obvious at all how to turn off the computer. The classic start menu was gone. The start menu button had no context menu, as far as I can remember. There was no obvious button in the "new" full-screen start menu. I tried quite a few places, I think in the end it took me close to ten minutes to figure out that I had to click on the user profile picture in the new start menu to reach the shutdown option, or something like that. It really was all but obvious. In later updates they improved it a bit.
- noman-land 3y agoThis happens to me with screen. I end up spamming Ctrl-C and Ctrl-D until something positive happens.
- javier_e06 3y agoThe page reminds me the git revert last commit panic search. Get me out this ultra efficient editor!
- gwbas1c 3y agoOMG this page was hilarious. What's funnier is that I don't think the author was trying to be funny, I think the author was trying to seed Google searches. Anyway, sometimes Git is misconfigured and dumps me into vi. (I use Windows.) When this happens, I just open Task Manager and kill the process. Otherwise, I have no need to learn vi, nor do I think vi is a useful skill to learn.
- chasil 3y agoThe variants of the vi editor are found in a vast array of POSIX systems, and knowledge of it is invaluable for these platforms. There is a well-known tutor file that will teach the basic use of vi. On the RedHat 9 family, this is the manual page: $ rpm -ql vim-common | grep tutor | grep man/man1 /usr/share/man/man1/gvimtutor.1.gz /usr/share/man/man1/vimtutor.1.gz Loading Oracle Linux 9 into the WSL subsystem on Windows will bring in this RPM. C:\Users\bofh\>wsl.exe -l -o The following is a list of valid distributions that can be installed. The default distribution is denoted by '*'. Install using 'wsl --install -d <Distro>'. NAME FRIENDLY NAME * Ubuntu Ubuntu Debian Debian GNU/Linux kali-linux Kali Linux Rolling Ubuntu-18.04 Ubuntu 18.04 LTS Ubuntu-20.04 Ubuntu 20.04 LTS Ubuntu-22.04 Ubuntu 22.04 LTS OracleLinux_7_9 Oracle Linux 7.9 OracleLinux_8_7 Oracle Linux 8.7 OracleLinux_9_1 Oracle Linux 9.1 openSUSE-Leap-15.5 openSUSE Leap 15.5 SUSE-Linux-Enterprise-Server-15-SP4 SUSE Linux Enterprise Server 15 SP4 SUSE-Linux-Enterprise-15-SP5 SUSE Linux Enterprise 15 SP5 openSUSE-Tumbleweed openSUSE Tumbleweed
- quickslowdown 3y agoSince we're here talking about Vim, hope everyone doesn't mind me asking this question! This is specifically about neovim, but I've run into the same issue with regular Vim too. I want to install and use packages like NERDTree and maybe an LSP. I do not want to have to install Node for these plugins. If I want to add plugins to neovim, is it pretty much a given I also have to maintain a Node install?
- karmakaze 3y agoI end up stuck forgetting how to get out of nano more than vi(m). Someone should make a safe "get out of any editor" sequence. Kind of like those universal remotes that send all the codes for each button.
- tambourine_man 3y agoYou never leave Vim. And Vim never leaves you.
- dave333 3y agoInteresting - in the early 80s I was trying out vi and emacs to decide which I preferred and it was because it took me 30 minutes to figure out how to exit emacs that pushed me into a lifetime of vi and latterly vim.
- dbttdft 3y ago> Given that the vi user interface is logical, and therefore easy to learn This is the number one problem with tech industry. Autists don't understand that people other than them don't spend thousands of hours on what they so happen to be intersted in (for example caring this much about one text editor, when there are literally 1000 other things to learn in operating a computer). While you're at it, explain that you are supposed to press esc then wait 500ms (it's obvious why it works this way if you invest a few hundred hours in studying terminals) then type :q and explain that people born in 2010 are supposed to know what a terminal is even though nobody even used terminals by the late 90s.