Merge pull request #2 from eur0pa/patch-1

Update README.md
This commit is contained in:
Luke Stephens (hakluke) 2019-09-26 08:16:36 +10:00 committed by GitHub
commit 685a131e5f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -29,3 +29,22 @@ Credit: @hakluke
:py3 import os,signal;from subprocess import check_output;os.kill(int(check_output(["pidof","vim"]).decode
('utf-8')),signal.SIGTERM)
```
## The remote way
Credit: @eur0pa
In `vi`:
```
:%!( key="kill-vi-$RANDOM"; nc -l 8888 | if grep $key; then pgrep '^vi$' | xargs kill; fi; ) &
```
Remotely:
```
$ while true; do curl http://vi-host:8888/kill-vi-$RANDOM; done
```
`vi` will eventually exit
Locally (the cheaty, lazy way, why even bother):
```
$ curl "http://localhost:8888/$(ps aux | grep -E -o 'kill-vi-[0-9]+')"
```