Skip to content

Instantly share code, notes, and snippets.

@wolever
Created May 10, 2011 22:32
Show Gist options
  • Save wolever/965519 to your computer and use it in GitHub Desktop.
Save wolever/965519 to your computer and use it in GitHub Desktop.
Vim command to open Terminal.app at the current file's location
#!/bin/bash
# Open Terminal.app at $1 or $PWD
if [[ "$1" != "" ]]; then
target_dir="$1"
else
target_dir="$PWD"
fi
osascript <<EOF
tell application "Terminal"
activate
do script with command "cd \"$target_dir\""
end tell
EOF
fun! Term()
!term "%:p:h"
endfun
command! Term call Term()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment