Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
How to Exit Vim (github.com/hakluke)
64 points by behnamoh on Aug 25, 2022 | hide | past | favorite | 21 comments


As the old joke goes:

I've been using vim for the past 20 years. Mainly because I haven't figured out how to exit it.


Peoples looking to exit vim are not legitimate to use vim.

Once you read the vim doc, and understand the core concept of vim, you only need ctrl-z.

I strongly hate this meme about quitting vim. This is the kind of saddest cargo cult entreprise by average joe unable to master their daily tool and prefer to spoil it and diss it, just to compensate the frustration generated by their limited mind.

This happened not so long ago when I was trying to install another plugin manager for vim to run smoothly my huge plugin list I copy pasted from Github that I was challenged by real vim master to basically run a vim for 6 months virgin of everything. Then after many years I discovered vim for the first time and how to use it correctly. The truth is that 99% of plugin are useless. If not 100%. I never quitted vim since then and totally improved my workflow and productivity by 10 factors just by understanding core concept of vim.


I cannot tell if you’re just going along with the bit, or if you’re completely serious. Either way, absolutely hilarious


The second paragraph is the giveaway of seriousness.


> Warning, this may break your entire computer

:!sudo dd if=/dev/urandom of=/dev/kmem

Newer kernels might dissable access to kmem. You can also compile the kernel to generate a panic on demand and crash when it panics.


There are some really clever ones in there, but for some reason I got the biggest kick out of this one:

    :!$SHELL


Hehe, nice one :)

Does this actually exec to the shell, or will vim continue running as its parent process (i.e. fork + exec)?


Vim continues to run as the parent. When you exit the child shell, you're back in Vim!


How about ZQ (shift z, shift q) or ZZ to save quit? Can't believe that is not mentioned...


TIL. Thanks.


Isn’t it a better use of our time figuring out why these poor souls keep accidentally opening vi/vim at the first place? Maybe defaults are not what they ought to be.

(But if it’s intentional then RTFQ — sincerely your local curmudgeon)


I accidentally end up in vim every time I set up a new system, because I forget that git uses `vi` for commit messages by default. At least I have finally memorized `git config --global core.editor` instead of having to look it up every time.


Previous (most recent) discussion thread: https://news.ycombinator.com/item?id=32373767


Previous (most recent) HN thread:

https://news.ycombinator.com/item?id=32373767


Just unplug the computer, no fancy commands necessary!



How to exit vim, brutal version:

    Ctrl+Z
    kill -9 %%


    kill -9 $(pgrep vim)


better "sudo killall -9"


Sadly, this doesn't work like it used to. On SunOS, running this with no args would result in all processes being killed, halting the system, possibly rebooting it (which would definitely stop vi). These days it just asks for more arguments.


pkill vim




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: