The 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.
I 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.
My 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.
I 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!).
> 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.
Most 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?!?"
Since 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?
I 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).
Interesting - 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.
I 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.
To 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.
Thanks 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.
OMG 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.
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
[0]: https://github.com/hakluke/how-to-exit-vim