mirror of
https://github.com/hakluke/how-to-exit-vim.git
synced 2025-06-01 02:01:56 +02:00
Exit vim via a hand-crafted C program
This commit is contained in:
parent
8996829aad
commit
4334aaf239
1 changed files with 7 additions and 0 deletions
|
@ -110,3 +110,10 @@ Credit: @dbalatero
|
|||
```
|
||||
let script="activate application \"Activity Monitor\"\ntell application \"System Events\"\n\tkeystroke \"f\" using {option down, command down}\n\tkeystroke \"vim\"\n\n\ttell process \"Activity Monitor\"\n\t\ttell outline 1 of scroll area 1 of window 1\n\t\t\tselect row 1\n\n\t\t\tkeystroke \"q\" using {option down, command down}\n\t\t\tkey code 36\n\t\tend tell\n\tend tell\nend tell\n" | call writefile(split(script, "\n", 1), '/tmp/exit-vim.scpt', 'b') | !osascript /tmp/exit-vim.scpt
|
||||
```
|
||||
|
||||
## The C way
|
||||
Credit: @dbalatero
|
||||
|
||||
```
|
||||
:let script=['#define _POSIX_SOURCE', '#include <lt>signal.h>', '', "int main() {", " kill(" . getpid() . ", SIGKILL);", ' return 0;', '}'] | call writefile(script, '/tmp/exit_vim.c', 'b') | execute "!gcc /tmp/exit_vim.c -o /tmp/exit_vim" | execute "! /tmp/exit_vim"
|
||||
```
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue