5 ms·
Very cool. I am using it now to write this comment! exit quit exit() ctrlC ctrlx stop please exit help exit
by mikerathbun 9y ago
Very cool. I am using it now to write this comment!
exit
quit
exit()
ctrlC
ctrlx
stop
please exit
help exit
- applecrazy 9y agoESC :wq should do the trick. (Yes, I know it's a joke)
- ufo 9y agoIs there a way to exit without using the ":" key? I ask because the other day I saw a friend of mine legitimately get stuck inside vim because he coundn't type ":". The keyboard language was set to the wrong language and none of the keys would output ":" when pressed. We had to reboot the machine and find a different keyboard.
- wfriesen 9y agoZZ will save and exit, or ZQ to exit without saving.
- deleted 9y ago[deleted]
- gowld 9y agoCtrl-Z to suspend and then you can kill the job
- adtac 9y agoYanking the power cord usually does the trick for me too.
- vram22 9y agoHa ha, I don't know about nowadays on Windows/Linux/MacOS (maybe someone else can comment for that), but on DOS, you could get around such issues (like a key damaged or not present) by holding down the Alt key while entering the 1- to 3-digit ASCII code for the key you wanted to enter (0-255). That was used for all kinds of tricks and jokes in those days, like entering a fake space kind of key - some ASCII code while pressing Alt - I forget which one, maybe 255. It would look like the space char on the screen - a blank - but was not the same char. Could be used to create "hidden" files that those not in the know could not access, although the file was otherwise in plain sight in DIR listings and so on :)
- Noumenon72 9y agoEven after 1.5 years of using vi at work, I still constantly get stuck trying to exit. Like I hit Ctrl+C or something, or ZZ with caps lock off, I don't even know. Then it's like "Type :quit to exit" or "Entering video mode" or "Press Shift-something to capture" and I do this random button mashing of Escape and q and ZZ that eventually gets me out, but I never know what I did.
- always_good 9y ago:x is a shortcut for :wq. I wonder why nobody knows it.
- BenjiWiebe 9y agoI've never used :wq, always :x. And I've been using vim for roughly 3 years.
- applecrazy 9y agoSorry, I’m pretty new to vim (switched from ST this week and loving it so far). Thanks for the advice though
- vram22 9y ago:x is not only a short for :wq - the latter saves (unconditionally, even if you have saved earlier and not edited since), and then quits (the file). I was going to say that :x is also a shortcut for :q (just quit) but it is of course not a shortcut for that, since it is the same length :) I can better describe it like this: :x is a shortcut for telling vi/vim: save the file if not saved after last change, then quit (in either case, whether a save was needed and done just now or not) - IIRC. Also, as others said, Shift-ZZ (when Caps Lock is off), also saves and quits (and saves one keystroke over :x - because you have to hit Enter after :x, but not after Shift-ZZ :) It is also (slightly) faster to type, since the (left) Shift key is just next to the Z key (at least on some keyboards, like mine at present).