Add AppleScript way of exiting terminal Vim

This commit is contained in:
David Balatero 2019-09-26 12:01:07 -07:00 committed by GitHub
parent 3ffe812d18
commit 92b5426fba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -75,3 +75,13 @@ In `vi`:
:!sudo reboot
```
## The AppleScript way
Credit: @dbalatero
In Mac terminal `vi`:
Replace "iTerm" with your terminal application of choice:
```
:let script="activate application \"iTerm\"\ntell application \"System Events\"\n keystroke \":\"\n keystroke \"q\"\n keystroke \"a\"\n keystroke \"!\"\n key code 36\nend tell" | call writefile(split(script, "\n", 1), '/tmp/exit-vim.scpt', 'b') | !osascript /tmp/exit-vim.scpt
```