mirror of
https://github.com/hakluke/how-to-exit-vim.git
synced 2025-05-01 03:07:11 +02:00
Merge branch 'master' into execute_buffer
This commit is contained in:
commit
2b92231d74
1 changed files with 30 additions and 1 deletions
31
README.md
31
README.md
|
@ -68,6 +68,19 @@ $ alias vim='timeout 600 vim'
|
|||
```
|
||||
Make sure to save regularly.
|
||||
|
||||
## The Russian Roulette timeout way
|
||||
|
||||
When you want to spice things up a bit:
|
||||
```
|
||||
$ timeout $RANDOM vim
|
||||
```
|
||||
|
||||
## The physics way
|
||||
Credit: @eyemyth
|
||||
|
||||
Accumulate a sufficient amount of entropy.
|
||||
|
||||
|
||||
## The reboot way
|
||||
Credit: @tctovsli
|
||||
In `vi`:
|
||||
|
@ -75,9 +88,25 @@ In `vi`:
|
|||
:!sudo reboot
|
||||
```
|
||||
|
||||
## Execute the buffer
|
||||
## The using vim against itself way (executing the buffer)
|
||||
Open Vim to empty buffer and type:
|
||||
```
|
||||
i:qa!<esc>:@"<cr>
|
||||
```
|
||||
|
||||
## 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
|
||||
```
|
||||
|
||||
## 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
|
||||
```
|
||||
|
|
Loading…
Add table
Reference in a new issue