Skip to content

Instantly share code, notes, and snippets.

@zunda
Last active November 18, 2017 07:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zunda/8be964b3fe6da27acc26e33af9ceb702 to your computer and use it in GitHub Desktop.
Save zunda/8be964b3fe6da27acc26e33af9ceb702 to your computer and use it in GitHub Desktop.
macOS 10.12.6でiTerm2を起動するApple Script
on run {input, parameters}
tell application "iTerm"
create window with default profile
activate
end tell
return input
end run
on run {input, parameters}
tell application "iTerm"
create window with default profile command "/path/to/vim-scratch.sh"
activate
end tell
return input
end run
#!/bin/sh
path=/tmp/scratch.`date +%H%M%S`.txt
pbpaste > $path
/usr/bin/vim -c 'set enc=utf8 fenc=utf8' $path
cat $path | pbcopy
sleep 0.5
@zunda
Copy link
Author

zunda commented Nov 18, 2017

  1. Automatorを起動してFile - NewからServiceをChoose、Service receives selected: no inputにして、左のUtilities - Run AppleScriptで上記をコピペ、Saveで適当な名前をつける
  2. System Preferences...、Keyboard - Shortcuts - Services - 下の方のGeneralに現れるのでショートカットキーを設定する

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment