Created
February 24, 2016 18:04
-
-
Save tweekmonster/d05f5027a5b77c371219 to your computer and use it in GitHub Desktop.
Script for creating the autoindent GIF for braceless.vim
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Script for creating the autoindent GIF for braceless.vim | |
-- https://github.com/tweekmonster/braceless.vim | |
to slowType(someText) | |
tell application "System Events" | |
repeat with i from 1 to count characters of someText | |
keystroke (character i of someText) | |
delay 0.15 | |
end repeat | |
end tell | |
end slowType | |
to fastType(someText) | |
tell application "System Events" | |
repeat with i from 1 to count characters of someText | |
keystroke (character i of someText) | |
delay 0.05 | |
end repeat | |
end tell | |
end fastType | |
to esc() | |
my togglekeycast() | |
tell application "System Events" | |
key code 53 | |
end tell | |
my togglekeycast() | |
end esc | |
to enter() | |
my togglekeycast() | |
tell application "System Events" | |
key code 36 | |
end tell | |
my togglekeycast() | |
end enter | |
to tabkey() | |
my togglekeycast() | |
tell application "System Events" | |
key code 48 | |
end tell | |
my togglekeycast() | |
delay 0.5 | |
end tabkey | |
to togglekeycast() | |
tell application "System Events" | |
key code 53 using {command down} | |
end tell | |
end togglekeycast | |
to doline(someText) | |
my fastType(someText) | |
my enter() | |
delay 0.3 | |
end doline | |
tell application "iTerm" | |
activate | |
delay 2 | |
my fastType("vim -u musings/gifvimrc") | |
my enter() | |
delay 0.5 | |
my fastType(":silent! cd musings") | |
my enter() | |
my fastType(":set laststatus=2") | |
my enter() | |
if true then | |
my fastType(":autocmd FileType python BracelessEnable +indent") | |
my enter() | |
my fastType(":set statusline=Braceless\\ autoindent") | |
my enter() | |
else | |
my fastType(":set statusline=Default\\ autoindent") | |
my enter() | |
end if | |
my fastType(":e! empty.py") | |
my enter() | |
my fastType(":") | |
my esc() | |
delay 2 | |
my fastType("i") | |
my doline("def example():") | |
my doline("if True:") | |
my doline("pass") | |
my doline("if False:") | |
my doline("pass") | |
my doline("else:") | |
my doline("pass") | |
my doline("elif:") | |
my doline("pass") | |
my enter() | |
my doline("try:") | |
my doline("pass") | |
my doline("except:") | |
my doline("if True:") | |
my doline("pass") | |
my doline("else:") | |
my doline("pass") | |
my doline("else:") | |
my doline("pass") | |
my esc() | |
delay 4 | |
my fastType(":e! terrible.py") | |
my enter() | |
delay 2 | |
my togglekeycast() | |
my slowType("=G") | |
my togglekeycast() | |
delay 4 | |
my fastType(":q!") | |
my enter() | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment