Open-source project
hakluke/how-to-exit-vim avatar
hakluke/how-to-exit-vim

hakluke/how-to-exit-vim: A Joke Repository That Is Also a Unix Reference

Below are some simple methods for exiting vim.

7,190 stars324 forksUnknownLicense varies

At a glance

What is it?
The repository collects dozens of ways to kill a Vim session, from the standard :q to a fork bomb, and the README is honest about which ones are dangerous. It is a joke that doubles as a catalogue of process-killing techniques.
Who is it for?
Adopt this repository as a bookmark or a teaching aid, not as a dependency. It has no build, no release and no test suite, so there is nothing to verify beyond reading the README and checking that each command matches your shell.
Can I use it commercially?
Not without permission. GitHub finds no licence file in the repository, and without a licence all rights are reserved by default: you may read the code but not reuse it. Check the README, or ask the authors, before using it.
Is it still maintained?
Yes. The repository last received commits 55 days ago.
What is it written in?
GitHub does not report a main language for this repository.

Answers come from the project's GitHub data, last synced on September 25, 2026, and from our analysis. They are not legal advice.

Editorial analysis

What hakluke/how-to-exit-vim actually is

This is a README-only repository. The top level contains README.md and an assets directory; there is no source tree, no package manifest and no build system. The README states its purpose in one line: "Below are some simple methods for exiting vim." What follows is a list of methods contributed by named people, each attributed with an @ handle, ranging from the legitimate to the deliberately absurd.

The audience is people who already know the joke. Vim has a reputation for trapping newcomers, and the repository leans into it: methods include pulling the plug, walking away, and a 500,000 USD hardware device called VIMKiller that links to a separate repository. The humour only lands if you have used a terminal, which is also why the repository is useful. Several entries are real techniques for finding and killing a process, written as one-liners you can adapt.

The mechanism: process discovery and signal delivery

Almost every method in the README reduces to two steps. First, find the process ID of the running editor. Second, send it a signal. The variations are in how the PID is found, because that is the part with actual engineering trade-offs.

The straightforward approach pipes ps through grep and awk to extract the second column, the PID, then hands it to xargs kill -9. The ps-less approach, credited to @tomnomnom, walks /proc looking for files named cmdline whose contents begin with the bytes vim followed by a NUL, extracts the directory name as the PID, and kills it. A third variant by @hakluke reads /proc status files and greps for the process name instead. The process-tree method by @kpumuk is the shortest: it reads PPid from /proc/$$/status, the parent of the shell Vim spawned, and kills that.

That last one is the most interesting design choice in the repository. Vim runs the :! command in a subshell, so $$ inside that subshell is not Vim's PID. Killing the parent is a way around needing to search at all. It is also fragile in the way all parent-based tricks are.

Installing it and running the ps-less method

There is nothing to install. The repository is a README, so the practical step is cloning it or opening the file on the web and copying the method you want. The README gives no install instructions because there is no artifact to install.

A first real use: open Vim, then run the ps-less method from inside it. The command is executed by the shell Vim spawns for :!, so it runs while Vim is still alive. According to the README, this one is credited to @tomnomnom.

vim
:!kill -9 $(find /proc -name "cmdline" 2>/dev/null | while read procfile; do if grep -Pa '^vim\x00' "$procfile" &>/dev/null; then echo $procfile; fi; done | awk -F'/' '{print $3}' | sort -u)

What you should see: the terminal returns to the shell prompt and Vim is gone. The find walks /proc, grep -P matches the NUL-terminated cmdline against the literal bytes vim\x00, awk splits the path on slashes and takes the third field as the PID, and sort -u deduplicates. If you have multiple Vim instances, this kills all of them, which the README does not flag but the command's sort -u implies.

A gentler variant, also in the README, uses the parent PID instead of searching:

vim
:!grep -P "PPid:\t(\d+)" /proc/$$/status | cut -f2 | xargs kill -9

This one is shorter and depends on the shell's parent being Vim. If you launched Vim from a wrapper script, that assumption breaks.

The methods that can damage your machine

The README is unusually careful about one entry and careless about others. The Passive-Aggressive Way is a bash fork bomb, and the README appends a note: "please don't try at home." The Yolo Way, credited to @ryanc, writes to /proc/sysrq-trigger and comes with the warning "Don't run this, it could break your computer." Those two are labelled.

Others are not. The reboot way runs sudo reboot from inside vi, which terminates the editor by terminating the machine. The Shoot First, Ask Questions Later way picks a random PID from the entire process table and kills it with sudo, so on a busy system it will kill something that is not Vim. The Russian Roulette variants randomise either the timeout or the process selection. A reader who copies these without reading the surrounding text is the failure mode this repository creates.

There is also a correctness limitation in the layered method by @mashuptwice, which the author states outright: it is "still stuck if multiple vim instances are running." That is the honest kind of note the rest of the file could use more of.

When this is the wrong tool, and what to use instead

If your actual problem is that you do not know how to leave Vim, this repository is the wrong answer. The real answer is :q to quit, :q! to quit without saving, :wq or :x to write and quit, and Esc followed by those commands if you are in insert mode. Vim's own documentation covers this under :help :quit. The repository's title is a joke about people who do not know that, so using it as a tutorial inverts its purpose.

If your actual problem is that a process is stuck and you need to kill it, the right alternative is a process manager or the standard tools rather than a /proc crawl. pgrep vim returns the PIDs directly, and pkill vim sends the signal, without the find and awk pipeline. The README's own remote way uses pgrep '^vi$' in its server-side command, so the author knows the tool exists. The advantage of the README's methods is that they work when ps is missing or restricted, which is why the ps-less variants exist at all. If ps works on your system, use pgrep and skip the ceremony.

Maintenance, licence and what the repository does not say

The last push to the default branch was on 2026-08-05. The repository is not archived. There are no releases, no version tags and no dependency files, so there is no upgrade path to plan and no breaking-change surface to track. A README-only repository changes only when someone opens a pull request to add a method; the maintenance cost to a user is zero because nothing is consumed as a library.

The licence is not stated in the repository. The README attributes each method to a named contributor, including @tomnomnom, @hakluke, @kpumuk, @caseyjohnellis, @PozziSan, @wodny, @rynaro, @w181496, @eur0pa, @Jorengarenar, @aarongorka, @aliva, @cfrost, @eyemyth, @tctovsli, @dbalatero, @IA_Baby46, @cheezmeister, @david50407, @tartansandal, @ryanc, @mashuptwice and @donkoch. Attribution is present; a licence grant is not. If you intend to reuse a snippet in your own project, the absence of a licence file is the thing to resolve before you do, not after. That is a factual gap, not legal advice.

Editorial conclusion

Adopt this repository as a bookmark or a teaching aid, not as a dependency. It has no build, no release and no test suite, so there is nothing to verify beyond reading the README and checking that each command matches your shell. Do not run the fork bomb, the sysrq-trigger line or the reboot command on a machine you care about. Before using any entry, confirm the process name it targets (vim, vi or gvim) matches what your terminal actually started, because the ps-less methods identify processes by matching /proc entries and will miss a differently named binary.

Frequently asked questions

How do I quit VI without saving my changes?

The standard command is :q! in normal mode, which discards changes. The repository does not present that as a method; it collects alternatives such as killing the process from inside Vim.

How do I save and exit the Vim editor?

The usual command is :wq, or :x, from normal mode. The README does not document these; it assumes the reader already knows them and lists ways to terminate the process instead.

How do I exit the vim meme?

The meme is the repository itself: a list of increasingly absurd ways to leave Vim, including pulling the plug, walking away and a fictional 500,000 USD hardware device. There is no separate thing to exit.

Official sources

  1. hakluke/how-to-exit-vim on GitHub
  2. Issues
  3. Project website
  4. README
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/hakluke-how-to-exit-vim.svg)](https://hysenlabs.com/projects/hakluke-how-to-exit-vim)