@Alexey  That is really awesome!  I will definitely check it out and play around with it.  

Here is what I use in Visor to achieve a similar functionality.  Depending on your usage, it may be better to use DTerm but I figured these might help someone out since they work for regular Terminal as well.

I map these to various keyboard shortcuts such as Command+Shift+C or Control+Shift+C with Quicksilver.

Applescript to copy the containing folder of the current finder selection to the clipboard:

tell application "Finder"

if selection is not {} then set the clipboard to POSIX path of (container of (first item of (selection as list) as alias) as alias)

end tell


Path of the Selection to the clipboard:

tell application "Finder"

if selection is not {} then set the clipboard to POSIX path of (first item of (selection as list) as alias)

end tell


Tell Terminal to go to the current finder directory (

tell application "Finder"

if selection is not {} then

set path_ to POSIX path of (container of (first item of (selection as list) as alias) as alias)

tell application "Visor"

do script with command "cd \"" & path_ & "\"" in window 1

activate

end tell

end if

end tell


I believe these can be modified relatively easily to use the current file in any application if you need to do that a lot.  I am definitely going to check out DTerm and see how it integrates into my normal terminal workflow.  Thanks for the info!!

Brandon