Below are some simple methods for exiting vim.
For real vim (and hacking) tips, follow hakluke and tomnomnom on twitter.
Credit: @tomnomnom
:!ps axuw | grep vim | grep -v grep | awk '{print $2}' | xargs kill -9
Credit: @tomnomnom
:!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)
Credit: @hakluke
:!find /proc -name status | while read file; do echo "$file: "; cat $file | grep vim; done | grep -B1 vim | grep -v Name | while read line; do sed 's/^\/proc\///g' | sed 's/\/.*//g'; done | xargs kill -9
Credit: @kpumuk
:!grep -P "PPid:\t(\d+)" /proc/$$/status | cut -f2 | xargs kill -9
Credit: @PozziSan
python -c "from os import system; system('killall -9 vim')"
Credit: @hakluke
:py3 import os,signal;from subprocess import check_output;os.kill(int(check_output(["pidof","vim"]).decode
('utf-8')),signal.SIGTERM)
:!perl -e 'while(</proc/*>){open($f, "$_/cmdline"); kill 9, substr($_,6) if <$f> =~ m|^vim\x00| }'
Credit: @wodny
- Reimplement vim in Rust.
- Call the project
rim
. - Run
rim
. - Exit
rim
using a borrowed command, ie.:q!
.
Credit: @rynaro
$ ruby -e 'system("killall -9 vim")'
Credit: @rynaro
$ ruby -e 'pid = `pidof vim`; Process.kill(9, pid.to_i)'
Credit: @w181496
In insert mode:
<C-R>=system("ps axuw | grep vim | grep -v grep | awk '{print $2}' | xargs kill -9")