Created
March 30, 2012 06:50
-
-
Save mybeky/2248020 to your computer and use it in GitHub Desktop.
Open MacVim's current file path in iTerm2
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
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