Skip to content

Instantly share code, notes, and snippets.

@mybeky
Created March 30, 2012 06:50
Show Gist options
  • Save mybeky/2248020 to your computer and use it in GitHub Desktop.
Save mybeky/2248020 to your computer and use it in GitHub Desktop.
Open MacVim's current file path in iTerm2
tell application "MacVim"
set window_title to name of window 1
set is_empty to offset of "[NO NAME]" in window_title
if is_empty is 0 then
set cwd to do shell script "echo '" & window_title & "' |sed 's/.* (\\(.*\\)).*/\\1/'"
tell application "iTerm"
make new terminal
tell the current terminal
activate current session
launch session "Default Session"
tell the last session
write text "cd " & cwd & "; clear; pwd"
end tell
end tell
end tell
end if
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment