Skip to content

Instantly share code, notes, and snippets.

@megalithic
Last active February 19, 2017 02:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save megalithic/1f0c8b7d085ecb74a0a8 to your computer and use it in GitHub Desktop.
Save megalithic/1f0c8b7d085ecb74a0a8 to your computer and use it in GitHub Desktop.
open a selected file in finder within a new tmux window within an iTerm2 (termception).. dump this into an automator doc and save it as an app:
set filename to POSIX path of input
set cmd to "cd `dirname " & filename & "`; vim " & filename
tell application "iTerm"
tell the current window
# Uncomment the next line if you want to create a new iTerm tab instead.
#create tab with default profile
tell the current session
tell application "iTerm" to activate
delay 1
# Create a new tmux window
tell application "System Events" to keystroke "t" using command down
delay 1
# Execute our command
write text cmd
end tell
end tell
end tell
@megalithic
Copy link
Author

this makes some assumptions of your setup with iterm2 and tmux. i'll eventually have it detect existing tmux sessions and if non exists will just open a regular ole iterm2 tab instead of a new tmux window using my cmd+t keybinding.

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