From cdd42d7ba9800d5d6096ae68386a4440ecc8223c Mon Sep 17 00:00:00 2001 From: Brad Riemann Date: Thu, 26 Sep 2019 09:03:34 -0500 Subject: [PATCH 1/3] Add Russian Roulette timeout mode --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index ee1c1ff..00998e6 100644 --- a/README.md +++ b/README.md @@ -68,6 +68,13 @@ $ alias vim='timeout 600 vim' ``` Make sure to save regularly. +### Russian Roulette mode + +When you want to spice things up a bit: +``` +$ timeout $RANDOM vim +``` + ## The reboot way Credit: @tctovsli In `vi`: From 92b5426fba51699926b01948923e7963f3512c96 Mon Sep 17 00:00:00 2001 From: David Balatero Date: Thu, 26 Sep 2019 12:01:07 -0700 Subject: [PATCH 2/3] Add AppleScript way of exiting terminal Vim --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index ee1c1ff..905c39d 100644 --- a/README.md +++ b/README.md @@ -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 +``` + From bc072fdd8ad7531f0b6b41cb1894a9ebca21d54b Mon Sep 17 00:00:00 2001 From: David Balatero Date: Thu, 26 Sep 2019 13:25:08 -0700 Subject: [PATCH 3/3] Add activity monitor way of exiting Vim --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 509d242..e119eb0 100644 --- a/README.md +++ b/README.md @@ -92,3 +92,9 @@ 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 ``` +# The Mac Activity Monitor way +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 +```